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
let multiply8 = (num) => num << 3; | |
multiply8(7); //We got 56 |
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 Benchmark = require('benchmark'); | |
var suite = new Benchmark.Suite; | |
var str_long = (new Array(50000)).join('0'); | |
var str_mid = (new Array(500)).join('0'); | |
var str_short = (new Array(5)).join('0'); | |
suite.add('concat#longstr', function() { | |
str_long + str_long; |
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
/** | |
* this file will be loaded before server started | |
* you can register app hook | |
*/ | |
const WEIXIN_APPID = appid; | |
const WEIXIN_APPSECRET = appsecret; | |
const WEIXIN_TOKEN = token; | |
const WEIXIN_AESKEY = aeskey; | |
think.middleware('parse_wechat', http => { |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset=utf-8 /> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
</body> | |
</html> |
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
function solve(modules){ | |
function getBranch(node, tree){ | |
var ret = []; | |
var current = node; | |
do{ | |
ret.push(current); | |
}while(current = tree[current]) | |
return ret; | |
} |
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
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
import sys | |
from xmlrpclib import ServerProxy | |
def main(): | |
url = sys.argv[1].strip() | |
if not url or not url.startswith('http://'): | |
print 'please enter a url!' |
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
function solve(jA, jB, target){ | |
var cA = [jA, 0], | |
cB = [jB, 0]; | |
var stateMap = {'0,0': true}, ops = []; | |
var solved = false; | |
//the state checked | |
function checked(){ | |
var st = [cA[1],cB[1]].join(); |
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
function convert(from, to){ | |
if(from.split('').sort().join('') != to.split('').sort().join('')){ | |
return []; | |
} | |
var res = []; | |
function proceed(stack, pos, prefix, ops){ | |
//找到一个解 | |
if(prefix === to){ |
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
function m(map){ | |
var max = 0, size = map.length; | |
return proceed(0); //回溯算法 | |
function proceed(pos){ | |
var max = 0; //放置城堡数 | |
for(var i = pos; i < size * size; i++){ | |
var y = i % size; |
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
<meta charset="utf-8"> | |
<script> | |
function MagicObject() { | |
return new Proxy(this, { | |
get: function (target, name) { | |
if (name in target) { | |
return target[name]; | |
} else { |
NewerOlder