Skip to content

Instantly share code, notes, and snippets.

@aisk
aisk / 0_reuse_code.js
Created February 12, 2016 14:29
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
@aisk
aisk / de2.py
Created February 2, 2016 09:38
import ast
def menu(*args, **kwargs):
def inner(f):
pass
return inner
a = ast.parse('''
@menu('xxx', parent='xxx')
class Xxx(object):
@aisk
aisk / de.py
Created February 2, 2016 08:58
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
@aisk
aisk / Vagrantfile
Last active December 10, 2015 15:45
Pyston develop environment vagrant box
# -*- mode: ruby -*-
# vi: set ft=ruby :
git_user_name = `git config --get user.name`.strip
git_user_email = `git config --get user.email`.strip
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.box_check_update = false
@aisk
aisk / x.py
Created October 14, 2015 05:34
d = {'a': 1, 'b': 2}
keys = d.keys()
for k in keys:
v = d[k]
d['xxx'] = 'ooo'
// generated by asdl_pyston.py
#include <algorithm>
#include <cmath>
#include <langinfo.h>
#include <sstream>
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Path.h"
#include "codegen/unwinding.h"
@aisk
aisk / xxx.py
Created September 7, 2015 02:47
import os import sys
# make stdout and stderr without buffer
sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)
sys.stderr = os.fdopen(sys.stderr.fileno(), 'w', 0)
'use strict';
var async = require('async');
var let_it_bug = true;
var ioFunc = function(cb) {
if (! let_it_bug) {
var result = 42; // do something to get the result
cb(undefined, 42);
var p1 = new Promise(function(resolve, reject) {
setTimeout(function() {
resolve(1);
}, 2);
});
var p2 = new Promise(function(resolve, reject) {
setTimeout(function() {
reject(1);
}, 1);
var assert = require("assert");
var activities = {
"Aqua aerobics": 4,
"Athletics, high jump, long jump, triple jump, javelin, pole vault": 6,
"Athletics, shot, discus, hammer": 4,
"Athletics, steeplechase, hurdles": 10,
"Badminton, competitive": 7,
"Badminton, social": 4.5,
"Baseball": 5,