Skip to content

Instantly share code, notes, and snippets.

ZHANG Cheng zhangcheng

Block or report user

Report or block zhangcheng

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View tsungconf.as
/*
* author Huber Flores
*/
# Install on each Node
$ su
# Perl Templating-Toolkit and the Gnu plotting utility to create HTML and graphical reports with the result data set.
$ apt-get install gnuplot-nox libtemplate-perl libhtml-template-perl libhtml-template-expr-perl
View schema.py
import json
from jsonschema import validate
str_schema = '''
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Product set",
"type": "array",
"items": {
View wsgi_intercept.py
import wsgi_intercept
import wsgi_intercept.mechanize_intercept
from wsgi_intercept.test_wsgi_app import create_fn
wsgi_intercept.add_wsgi_intercept('some_host', 80, create_fn)
b = wsgi_intercept.mechanize_intercept.Browser()
response = b.open('http://some_host:80')
response.read()
import wsgi_intercept
View gist:5596903
def f(a, L=[]):
L.append(a)
return L
print f(1)
print f(2)
print f(3)
@zhangcheng
zhangcheng / gist:4494041
Created Jan 9, 2013
meteor client side 避免动日期类型
View gist:4494041
### mongo shell
> db.todos.find({text: 'Ada Lovelace'})
{ "_id" : "fd53324c-412f-49e8-bc12-28aaba5cf878", "hello" : "world", "list_id" : "06ab59ee-cfa0-4469-bd11-8f4077040a06", "shot_at" : ISODate("2013-01-09T15:23:35.662Z"), "tags" : [ "Computer Science" ], "text" : "Ada Lovelace", "timestamp" : 1357743708239 }
> db.todos.update({text: 'Ada Lovelace'}, {$set: {info: {tm: new Date(), name: "a1"}}})
> db.todos.find({text: 'Ada Lovelace'})
{ "_id" : "fd53324c-412f-49e8-bc12-28aaba5cf878", "hello" : "world", "info" : { "tm" : ISODate("2013-01-09T15:26:44.365Z"), "name" : "a1" }, "list_id" : "06ab59ee-cfa0-4469-bd11-8f4077040a06", "shot_at" : ISODate("2013-01-09T15:23:35.662Z"), "tags" : [ "Computer Science" ], "text" : "Ada Lovelace", "timestamp" : 1357743708239 }
### chrome js console
View gist:3022997
<div class="imageContent" title="图片内容" style="width: 840px;">
<form method="POST" action="http://v0.api.upyun.com/pic-sandbox/" enctype="multipart/form-data">
{{#with upyun}}
<input name="policy" value={{policy}} type="hidden">
<input name="signature" value={{signature}} type="hidden">
<input type="file" name="file">
<input type="submit" name="upload">
{{/with}}
</form>
</div>
@zhangcheng
zhangcheng / coffee
Created Jun 25, 2012
WB2 fetch own's info
View coffee
WB2.anyWhere (W) ->
W.widget.connectButton
id: "wb_connect_btn"
type: '3,2'
callback :
login: (o) ->
console.log o
logout: ->
console.log ''
@zhangcheng
zhangcheng / config.coffee
Created Jun 15, 2012
used for require.js
View config.coffee
require.config
paths:
jquery: "/packages/jquery/jquery"
underscore: "/packages/underscore/underscore"
backbone: "/packages/backbone/backbone"
shim:
backbone:
deps: ["underscore", "jquery"]
exports: "Backbone"
@zhangcheng
zhangcheng / gist:2692431
Created May 14, 2012
towerjs build error
View gist:2692431
tower :: (master*) » cake build-generic ~/repo/git/nodejs/tower
src/tower/server/model.coffee
src/tower/server/tasks.coffee
src/tower/view/locale/en.coffee
undefined
fs.js:240
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
Error: ENOENT, no such file or directory './test/example/public/javascripts/vendor/javascripts/tower.js'
You can’t perform that action at this time.