This file contains hidden or 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
| local inspect = require "inspect" | |
| local web = require "web" | |
| app = web.Application:new() | |
| app:handle('GET', '^/?$', function(req, res) | |
| res.print('this is index') | |
| end) | |
| app:handle('GET', '^/about/?$', function(req, res) |
This file contains hidden or 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
| #include <stdio.h> | |
| #include <stdlib.h> | |
| struct Person { | |
| char* name; | |
| void (^say)(void); | |
| }; | |
| struct Person *PersonNew(char *name) { | |
| struct Person *self = malloc(sizeof(struct Person)); |
This file contains hidden or 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 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, |
This file contains hidden or 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 p1 = new Promise(function(resolve, reject) { | |
| setTimeout(function() { | |
| resolve(1); | |
| }, 2); | |
| }); | |
| var p2 = new Promise(function(resolve, reject) { | |
| setTimeout(function() { | |
| reject(1); | |
| }, 1); |
This file contains hidden or 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 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); |
This file contains hidden or 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 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) |
This file contains hidden or 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
| // 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" |
This file contains hidden or 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
| d = {'a': 1, 'b': 2} | |
| keys = d.keys() | |
| for k in keys: | |
| v = d[k] | |
| d['xxx'] = 'ooo' |
This file contains hidden or 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
| # -*- 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 |
This file contains hidden or 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 |