Skip to content

Instantly share code, notes, and snippets.

View leewind's full-sized avatar
💭
I may be slow to respond.

Michael.Lee leewind

💭
I may be slow to respond.
  • YaoJIngRiver Global Hedge Fund
  • Shanghai
View GitHub Profile
@leewind
leewind / pandas_iter.py
Created January 12, 2020 14:08
遍历pandas
for index, row in df.iterrows():
print row["c1"], row["c2"]
@leewind
leewind / datetime_mint.py
Created January 12, 2020 14:06
python string to datetime
from datetime import datetime
datetime_str = '09/19/18 13:55:26'
datetime_object = datetime.strptime(datetime_str, '%m/%d/%y %H:%M:%S')
print(type(datetime_object))
print(datetime_object) # printed in default format
@leewind
leewind / matplotlib_simple_plot
Created December 4, 2018 06:29
Create a simple plot
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
# Data for plotting
t = np.arange(0.0, 2.0, 0.01)
s = 1 + np.sin(2 * np.pi * t)
fig, ax = plt.subplots()
ax.plot(t, s)
@leewind
leewind / 0_reuse_code.js
Last active August 29, 2015 14:24
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@leewind
leewind / css.ellipsis
Created August 14, 2014 01:57
css:ellipsis
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
@leewind
leewind / gist:9e050bb1ae4260a0cbca
Last active August 29, 2015 14:05
nodejs:fs.readFile
var fs = require('fs');
fs.readFile("debug/info.txt", {encoding:"utf8"}, function(err, data) {
if(err) {
console.log(err);
} else {
parse(data);
}
});
@leewind
leewind / gist:0fdfad8d54e6b1d94456
Created August 13, 2014 02:41
nodejs:fs.writeFile
var fs = require('fs');
fs.writeFile("debug/info.txt", jsonstr, {encoding:"utf8"}, function(err) {
if(err) {
console.log(err);
} else {
console.log("The file was saved!");
}
});
@leewind
leewind / gist:4803c95ccbd285831860
Last active August 29, 2015 14:02
No binary for PhantomJS browser on your platform

When Yeoman reports error in Window 7:

ERROR [launcher]: No binary for PhantomJS browser on your platform. Please, set "PHANTOMJS_BIN" env variable.

it needs to set PHANTOMJS_BIN.

Step 1

Unzip the file phantomjs-1.9.7.windows.zip to one folder, I just put it in 'D:\michael\software\phantomjs-1.9.7-windows'

require.config({
baseUrl: '/backbone-tests/',
paths: {
'jquery' : '/app/libs/jquery',
'underscore' : '/app/libs/underscore',
'backbone' : '/app/libs/backbone',
'mocha' : 'libs/mocha',
'chai' : 'libs/chai',
'chai-jquery' : 'libs/chai-jquery',
'models' : '/app/models'