zhangyang5511
8/31/2016 - 1:32 AM

Here are some things you can do with Gists in GistBox.

Here are some things you can do with Gists in GistBox.

#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Baidu.com, Inc. All Rights Reserved
#

"""
@file: gen.py
@author: zhangyang(zhangyang40@baidu.com)
@time: 2016/10/8 10:37
"""

import pandas as pd
import math

if __name__ == '__main__':
    array_index = ['-0.3,-0.25', '-0.25,-0.2', '-0.2,-0.15', '-0.15,-0.1', '-0.1,-0.05', '-0.05,0', '0,0.05',
                   '0.05,0.1', '0.1,0.15', '0.15,0.2', '0.2,0.25', '0.25,0.3']
    key_old = "扭亏, 并购重组, 并购, 资产重组, 重组, 摘帽, 预增, 预盈, 改革, 收购, 高送转, 股权激励, 国改, 借壳, 增持, 涨停, 暴涨, 转型, 新概念, 送转, 送股, 派息, 新业务, 合并, 定增, 增发, 十送十, 非公开发行, 溢价, 10送10, 分红, 10转10, 员工持股, 萎缩, 做空, 跳水, 暴跌, 减持, 跌停, 过期, 折价, 业务萎缩, 负债, 丑闻, 预亏, 伪劣, 被立案调查, 存款丢失, 并购失败, 造假, 定增失败, 解禁, 假冒, 预减, 违规, 收购失败, 腐败, 转型失败, 破产, 续亏, 退市, 重组失败, 借壳失败, 带帽"
    key_old.decode("utf8")
    key_list = key_old.split(",")
    rdf = pd.DataFrame(columns=array_index, index=key_list)
    rdf = rdf.fillna(0)
    sdf = pd.read_csv("bin/state.csv", sep='\t', index_col=0, header=0).T
    sdf.index.name = "key"
    for index, rows in sdf.iterrows():
        index = index.decode('utf8')
        print index
        for col in rows:
            if col > -0.3 and col < 0.3:
                index_col = int(math.floor(col / 0.05)) + 6
                rdf.ix[index, [index_col]] += 1

Use Gists to keep track of any information you'd like to remember later on.


White Chocolate Raspberry Cheesecake

From: http://allrecipes.com/Recipe/White-Chocolate-Raspberry-Cheesecake/Detail.aspx

Ingredients

  • 1 cup chocolate cookie crumbs
  • 3 tablespoons white sugar
  • 1/4 cup butter, melted
  • 1 (10 ounce) package frozen raspberries
  • 2 tablespoons white sugar
  • 2 teaspoons cornstarch
  • 1/2 cup water
  • 2 cups white chocolate chips
  • 1/2 cup half-and-half cream
  • 3 (8 ounce) packages cream cheese, softened
  • 1/2 cup white sugar
  • 3 eggs
  • 1 teaspoon vanilla extract

Directions

  1. In a medium bowl, mix together cookie crumbs, 3 tablespoons sugar, and melted butter. Press mixture into the bottom of a 9 inch springform pan.

  2. In a saucepan, combine raspberries, 2 tablespoons sugar, cornstarch, and water. Bring to boil, and continue boiling 5 minutes, or until sauce is thick. Strain sauce through a mesh strainer to remove seeds.

  3. Preheat oven to 325 degrees F (165 degrees C). In a metal bowl over a pan of simmering water, melt white chocolate chips with half-and-half, stirring occasionally until smooth.

  4. In a large bowl, mix together cream cheese and 1/2 cup sugar until smooth. Beat in eggs one at a time. Blend in vanilla and melted white chocolate. Pour half of batter over crust. Spoon 3 tablespoons raspberry sauce over batter. Pour remaining cheesecake batter into pan, and again spoon 3 tablespoons raspberry sauce over the top. Swirl batter with the tip of a knife to create a marbled effect.

  5. Bake for 55 to 60 minutes, or until filling is set. Cool, cover with plastic wrap, and refrigerate for 8 hours before removing from pan. Serve with remaining raspberry sauce.

Create documentation for your projects. Like so:


Most popular keyboard shortcuts within GistBox

  • Up/Down - Previous/Next Gist
  • Ctrl+e - Edit a selected Gist
  • Ctrl+s - Save Gist

Save Gists from anywhere with Clipper

GistBox Clipper is the companion extension to GistBox, the most beautiful way to organize code snippets. It allows a user to create a GitHub Gist from any page on the web.

Download from the Chrome Web Store

# Use Gists to store entire functions
class QuickSort
 
  def self.sort!(keys)
    quick(keys,0,keys.size-1)
  end
 
  private
 
  def self.quick(keys, left, right)
    if left < right
      pivot = partition(keys, left, right)
      quick(keys, left, pivot-1)
      quick(keys, pivot+1, right)
    end
    keys
  end
 
  def self.partition(keys, left, right)
    x = keys[right]
    i = left-1
    for j in left..right-1
      if keys[j] <= x
        i += 1
        keys[i], keys[j] = keys[j], keys[i]
      end
    end
    keys[i+1], keys[right] = keys[right], keys[i+1]
    i+1
  end
 
end
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console