- 安装
msys2
到/e/jamit/sdk
- 初始话脚本如下
sed -i "s#https\?://mirror.msys2.org/#https://mirrors.tuna.tsinghua.edu.cn/msys2/#g" /etc/pacman.d/mirrorlist*
pacman -Syu --noconfirm
pacman -S rsync openssh vim git --noconfirm
#!/usr/bin/env python3 | |
import subprocess as sp | |
from datetime import datetime | |
import sys | |
lasttime = datetime.now() | |
cnt = 0 |
#dummy vim config | |
set tabstop=4 | |
set shiftwidth=4 | |
set softtabstop=4 | |
set expandtab | |
set nu |
function quick(nums) { | |
if (nums.length===0) { | |
return []; | |
} | |
var pivot = nums.shift(); | |
var a = nums.filter(function(num) { | |
return num<=pivot; | |
}); |
function testClosure(paramClosure) { | |
var innerClosure = 100; | |
return function() { | |
paramClosure++; | |
innerClosure--; | |
} | |
} |
<?php | |
class SortHelper { | |
private static $field; | |
static function byField(&$data, $field) { | |
self::$field = $field; | |
return usort($data, array('self', 'cmp')); | |
} | |
private static function cmp($a, $b) { | |
return $a[self::$field] > $b[self::$field]; | |
} |
<?php | |
function msort(&$data, $field, $order='asc') { | |
return usort($data, function($a, $b) use ($field, $order) { | |
return $order==='asc' ? $a[$field] < $b[$field] : $a[$field] > $b[$field]; | |
}); | |
} | |
//example | |
$data = array(array('t'=>1, 'p'=>'aBc'), array('t'=>3, 'p'=>'aBb')); | |
$rzt = msort($data, 't', 'asc'); |
(function($) { | |
var key = 'history:mock'; | |
var historyDb = { | |
cursor: null, | |
action: null, | |
urls: [] | |
}; | |
function saveState() { | |
sessionStorage.setItem(key, JSON.stringify(historyDb)); | |
} |
function getAttrSafe(obj, keyChain, delimiter) { | |
delimiter = delimiter || '.'; | |
if (!keyChain) { throw Error('keyChain should not be a empty value')}; | |
var keys = keyChain.split(delimiter); | |
console.log(keys); | |
try { | |
for (var i = 0; i < keys.length; i++) { | |
obj = obj[keys[i]] | |
if (obj === undefined) { return null;}; |
(function(window) { | |
if (window.Float32Array) return; | |
var unsigned = 0; | |
var signed = 1; | |
var floated = 2; | |
function TypedArray(klass, arg, offset, length) { | |
var a, b, bits, i, imax; | |
if (Array.isArray(arg)) { |