This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AV.Cloud.define('loginWeApp', function(request, response) { | |
var WX_APP_ID = 'WX_APP_ID' | |
var WX_SECRET = 'WX_SECRET'; | |
var code = request.params.code; | |
var signature = request.params.signture; | |
var rawData = request.params.rawData; | |
var userInfo = JSON.parse(rawData); | |
var openid, user; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs'); | |
var router = require('express').Router(); | |
var heapdump = require('heapdump'); | |
var AV = require('leanengine'); | |
router.post('/snapshot', function(req, res, next) { | |
var name = 'dump_' + Date.now() + '.heapsnapshot'; | |
heapdump.writeSnapshot('/tmp/' + name, function(err, filename) { | |
if(err) { | |
return next(err); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ast | |
def menu(*args, **kwargs): | |
def inner(f): | |
pass | |
return inner | |
a = ast.parse(''' | |
@menu('xxx', parent='xxx') | |
class Xxx(object): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def menu(name, parent_name): | |
do_some_thing_with_params(name, parent_name) | |
def inner_func(f): | |
do_some_thing() | |
return f() | |
return inner_func |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# buildin functions | |
# add -> integer -> integer | |
add 1 2 # => 3 | |
# log -> nothing | |
log 1 | |
# variable assignment |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
const ( | |
MEMORY_SIZE = 100 | |
) | |
type State struct { | |
Instructions string | |
Memory []byte | |
Ip int |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define bt (import "bottle")) | |
(define route (attr bt "route")) | |
(define (index) "Hello") | |
((route "/") | |
(@callable (lambda () | |
"Hello"))) | |
((attr bt "run")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
VObject. Value ::= "{" [Item] "}" ; | |
ObjItem. Item ::= String ":" Value ; | |
separator Item "," ; | |
terminator Item "" ; | |
VArray. Value ::= "[" [Value] "]" ; | |
separator Value "," ; | |
terminator Value "" ; | |
VInt. Value ::= Integer ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
from pprint import pprint | |
RIGHT, DOWN, LEFT, UP = 1, 2, 3, 4 | |
class MatrixWalker(object): | |
def __init__(self, width): | |
self.width = width | |
x = width + 2 # 多一圈,作为最外圈的墙壁 |