Skip to content

Instantly share code, notes, and snippets.

var data = {
stat: {
mastery: {
zh: '精通',
detail: '影响角色不同天赋的不同技能效果'
},
stamina: {
zh: '耐力',
detail: '影响角色和宠物的生命值'
},
var fs = require('fs')
var Q = require('q')
var fs_stat = Q.denodeify(fs.stat)
var fs_readdir = Q.denodeify(fs.readdir)
var files = [
'./fixtures/file1',
'./fixtures/file2',
'./fixtures/file3',
'./fixtures/file4'
@rixtox
rixtox / README.md
Last active August 29, 2015 13:57
JavaScript Asynchronous Deep Mapping With Promise

deepMap(object, iterator [, routePrefix])

Iterate and map recursively into an object. Return a promise object with a standard then interface created by Q. The depth and data types can be controlled by the iterator.

When encounters an array object, the returned value is an object use the indices of the array as its keys in String.

Note, that module q is required to handle the async quenue and create promises.

Arguments

bigf = (n) ->
for i in [2..Math.sqrt n]
return n / i unless n % i
n
LPF = (n) ->
bf = bigf n
return bf if bf == n
LPF bf
var result = ~ function(str) {
// Define a DSL
var r = function(target, replace) {
str = str.replace(new RegExp(target, 'gi'), replace || target);
};
// Use the DSL
r('JavaScript');
r('gogle', 'Google');
var alias;
S.cfga({
defaultToCurrentScreen: true,
nudgePercentOf: 'screenSize',
resizePercentOf: 'screenSize'
});
alias = {
full: S.op('move', {
Windows Registry Editor Version 5.00
[-HKEY_CLASSES_ROOT\Directory\shell\runas]
[HKEY_CLASSES_ROOT\Directory\shell\runas]
@="Open command window here as Administrator"
"HasLUAShield"=""
[HKEY_CLASSES_ROOT\Directory\shell\runas\command]
@="cmd.exe /s /k pushd \"%V\""
@rixtox
rixtox / 50-huawei-e1750.rules
Last active August 29, 2015 14:14
/etc/udev/rules.d/50-huawei-e1750.rules
SUBSYSTEM=="usb",
ATTR{idVendor}=="12d1",
ATTR{idProduct}=="1446",
RUN+="usb_modeswitch -v 12d1 -p 1446 -W -J"
RUN+="asterisk -x 'dongle cmd dongle0 AT^SYSCFG=13,1,3FFFFFFF,1,2'"
@rixtox
rixtox / .tmux.conf
Last active August 29, 2015 14:17 — forked from shouya/.server-setup
set -g default-terminal "xterm-256color"
set-option -g prefix M-n
set-window-option -g mode-keys emacs
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# Author: rix <i@rix.li>
pkgname=mr
pkgver=1.0
pkgrel=1
pkgdesc="A tool tomanage all your version control repositories"
arch=('any')
url="https://myrepos.branchable.com"
license=(GPL)
makedepends=('git')