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 tokenRules = [ | |
['number', /^\d+/], | |
['space', /^ +/], | |
'+', '-', '*', '/' | |
] | |
var str = '1 + 2 * 3 + 33 / 3' | |
function lex(str, tokenRules) { | |
var tokens = [] |
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 tokenRules = [ | |
['number', /^\d+/], | |
['space', /^ +/], | |
'+', '-', '*', '/' | |
] | |
var str = '1 + 2 * 3 + 33 / 3' | |
function lex(str, tokenRules) { | |
var tokens = [] |
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
<script type='x' id='markdown'> | |
title | |
=== | |
> blockquote | |
code | |
code2 | |
### head |
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
<script type='x' id='markdown'> | |
title | |
=== | |
> blockquote | |
code | |
code2 | |
### head |
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
// copy from https://github.com/gvangool/node-socks | |
// it is useful but shit code style | |
// save and one day pretty it | |
var net = require('net'), | |
util = require('util'), | |
log = function(args) { | |
//console.log(args); | |
}, | |
info = console.info, | |
errorLog = console.error, |
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
!function($, doc) { | |
if (!$ || !$.fn) return | |
var css3 = function() { | |
var style = doc.body.style | |
var test = ['transition', 'webkitTransition', 'MozTransition', 'msTransition'] | |
for (var i = 0, x; x = test[i++];) { | |
if (x in style) { | |
return x | |
} |
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
-- koa style downstream and upstream | |
local thread1 = coroutine.create(function(down) | |
print('thread1-down') | |
coroutine.yield(down) | |
print('thread1-up') | |
end) | |
local thread2 = coroutine.create(function(down) | |
print('thread2-down') |
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
!function(fn) { | |
window.$ = fn() | |
}(function() { | |
var $ = function(selector, context) { | |
return new $.fn.init(selector, context) | |
} | |
// var |
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
package { | |
import flash.external.ExternalInterface; | |
public class Log { | |
public static var logs:Array = []; | |
private static const INHERIT:String = 'color:inherit'; | |
private static const PREFIX:String = ''; | |
private static const LS_KEY:String = 'debug'; |
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
// https://browser.primatelabs.com/mac-benchmarks | |
Object.keys($('#mac32').find('tr').map(function() {return $(this).find('.name a').text()}).toArray().map(function(x) {return (/\w+ \d{4}/.exec(x) || [])[0]}).filter(function(x) {return x}).reduce(function(prev, val, key) {prev[val] = 1; return prev}, {})).map(function(x) {return x.split(' ')}).sort(function(x, y) {return x[1] - y[1]}).map(function(arr) {return arr[1] + ' ' + arr[0]}).join('\n') |