Node js 中通过 arguments 对象修改/增加参数的方法
function foo() {
console.log(arguments);
console.log(arguments['extra']);
}
foo.apply({}, {'0':'arg_1', '1':'arg_2', length: 2});
Node js 中通过 arguments 对象修改/增加参数的方法
function foo() {
console.log(arguments);
console.log(arguments['extra']);
}
foo.apply({}, {'0':'arg_1', '1':'arg_2', length: 2});
proxy
dropbox proxy MODE [TYPE] [HOST] [PORT] [USERNAME] [PASSWORD] Manually sets proxy settings for Dropbox.
function sendToES(topic, list, noRetry) { | |
let _list = list.splice(0); | |
reqHelper.post('/_bulk', new Buffer(_list.concat('').join(LF)), (resp, code) => { | |
/** 错误处理*/ | |
if (code !== 200) { | |
console.log('HTTP FAILED CODE:', code); | |
dumpDisk(_list); | |
} else if (resp.indexOf('"errors":true,') !== -1) { | |
let errorInfo = []; // errorInfo structure: [{i:index, t: error_type, s: status},{} ...] |
'use strict'; | |
const http = require('http'); | |
const originalString = 'Today we see a good accelerator: http://alchemistaccelerator.com, you can found some thing in the wikipedia, https://en.wikipedia.org/wiki/The_Alchemist_Accelerator. or google it by : https://www.google.com.hk/search?es_sm=91&q=alchemist+accelerator&oq=alchemist+a&gs_l=serp.3.2.0l10.233056.233264.0.235425.2.2.0.0.0.0.134.267.0j2.2.0....0...1c.1j4.64.serp..0.2.265.J6dlgO9eRVI'; | |
function fn(inputString, callback) { | |
// not a strict url match pattern | |
var regex = /https?:\/\/[\d\w\.\/_\-\?&=+#@]+\/?/g; | |
const newContent = []; |
var orginalData = [{name:'jch', age:30, score:90, sex: 1, lesson: 'math'},{ name:'oh', age:31, score: 80, sex:1, lesson: 'math'}, {name:'jia', age:27, score: 70, sex:0, lesson: 'math'}, {name:'jch', age: 30, score: 80, sex: 1, lesson: 'english'}]; | |
const fn_01 = (data, specifiedAge) => data.filter(item => item.age > specifiedAge); | |
const fn_02 = (data, specifiedAge) => data.reduce((prev, curr) => { | |
if (curr.age > specifiedAge) { | |
prev.name.push(curr.name); | |
prev.lesson.push(curr.lesson); | |
} | |
return prev; |
Adding --output-24bit to the TiMidity options in Solfege fixes sound problems for me
I am currently trying out GNU Solfege for ear and rhythm training. Solfege uses TiMidity for playback. On my machine, the sound output always started with an annoying crackling for each exercise. Some googling brought up this solution. While that link has nothing to do with Solfege, following its advice helped in my case, too. To remove the crackling in Solfege, I did the following:
In Solfege, open the File > Preferences Menu Choose External Programs Under Audio File Players - MIDI it should say /usr/bin/timidity (or something similar) add --output-24bit to the options for that entry (my complete options for timidity are --output-24bit -idqq %s)
cat $Filetemp | parallel --pipe 'sed -e "s/[[:space:]]+/ /g"' > standard.txt
function Person(){ | |
this.name = 'anonymous' | |
} | |
Person.prototype.toJSON = function toJSON(){ | |
return 'Person ' + this.name; | |
}; | |
Person.prototype.pro01 = 'yes'; |
{
if(FNR==NR) { # first file
map[$1]=1
} else { # second file
if ($1 in map) {
} else {
print $1
}
}
'use strict'; | |
// use node-debug to run client.js and observe the memory useage. | |
var http = require('http'); | |
var keepAliveAgent = new http.Agent({keepAlive: true, maxSockets: 500}); | |
var list = []; | |
for (var i = 0; i < 500; i++) { | |
list.push("hello world"); | |
} |