Skip to content

Instantly share code, notes, and snippets.

@zhangcheng
zhangcheng / gist:2692431
Created May 14, 2012 07:18
towerjs build error
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'
@zhangcheng
zhangcheng / config.coffee
Created June 15, 2012 07:33
used for require.js
require.config
paths:
jquery: "/packages/jquery/jquery"
underscore: "/packages/underscore/underscore"
backbone: "/packages/backbone/backbone"
shim:
backbone:
deps: ["underscore", "jquery"]
exports: "Backbone"
@zhangcheng
zhangcheng / coffee
Created June 25, 2012 18:06
WB2 fetch own's info
WB2.anyWhere (W) ->
W.widget.connectButton
id: "wb_connect_btn"
type: '3,2'
callback :
login: (o) ->
console.log o
logout: ->
console.log ''
<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 / gist:4494041
Created January 9, 2013 15:31
meteor client side 避免动日期类型
### 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
def f(a, L=[]):
L.append(a)
return L
print f(1)
print f(2)
print f(3)
@zhangcheng
zhangcheng / wsgi_intercept.py
Last active December 17, 2015 11:59
Snippets
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
import json
from jsonschema import validate
str_schema = '''
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Product set",
"type": "array",
"items": {
/*
* 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
{
"$schema": "https://raw.githubusercontent.com/jsonresume/resume-schema/v1.0.0/schema.json",
"meta": {
"canonical": "https://raw.githubusercontent.com/jsonresume/resume-schema/master/resume.json",
"version": "v1.0.0",
"lastModified": "2017-12-24T15:53:00",
"theme": "actual"
},
"basics": {
"name": "Cheng Zhang",