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
// sort and no using any `var` statement | |
function sort_(list) { | |
return list.map(function(item, i){ | |
return (function(min_val, sum) { | |
return list.filter(function(o, j) { | |
return (o < min_val) && (min_val = o || true); | |
}).slice(-1).map(function(o, j) { | |
list[list.indexOf(o)] = sum; | |
return o; |
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
/* | |
* check the array is sorted | |
* return: if positive -> 1 | |
* if negative -> -1 | |
* not sorted -> 0 | |
*/ | |
Array.prototype.isSorted = function() { | |
return (function(direction) { | |
return this.reduce(function(prev, next, i, arr) { |
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 fs = require('fs'); | |
var util = require('util'); | |
var Writable = require('stream').Writable; | |
function MyWriteStream() { | |
Writable.call(this); | |
} | |
util.inherits(MyWriteStream, Writable); | |
MyWriteStream.prototype._write = function(chunk, encoding, callback) { |
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
##################################################### | |
# Download Specific folders from Github using SVN | |
# | |
# Author: Declan Cook | |
# Licence: MIT | |
##################################################### | |
GHDOMAIN="https://github.com/" | |
IN=$1 | |
IN=${IN##$GHDOMAIN} | |
BRANCH="trunk" |
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
Readable.prototype.pipe = function(dest, pipeOpts) { | |
var src = this; | |
var state = this._readableState; | |
switch (state.pipesCount) { | |
case 0: | |
state.pipes = dest; | |
break; | |
case 1: | |
state.pipes = [state.pipes, dest]; |
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 request = require('request'); | |
var async = require('async'); | |
var path = require('path'); | |
var fs = require('fs'); | |
var baseURL = 'http://acg.sugdream.com/_uploadfiles/iphone5/300/'; | |
function checkRootDir() { | |
var reg = /[0-9]+\.jpg/g; | |
request(baseURL, function(er, res, body) { |
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 startTimer(fn) { | |
var interval = Math.random()*100; | |
console.log('interval:',interval); | |
var timer = setTimeout(function() { | |
fn(); | |
startTimer(fn); | |
}, interval); | |
} |
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> | |
<!-- TemplateBeginEditable name="doctitle" --> | |
<title>杭州绿尚室内家居环保有限责任公司</title> | |
<!-- TemplateEndEditable --> | |
<!--<meta name="keywords" content="环保 检测 家居 绿尚 绿色 室内" /> | |
<meta name="description" content=" 我公司主导产品定位为室内家居环保一体化服务。一体化服务是指集咨询、检测、环保产品销售、上门污染治理等独立服务为一体的新服务模式。可根据顾客不同的定位需求来设计个性化方案,挑选合适的产品来为顾客改善家居环境。为顾客解决环保问题省去了原本繁冗复杂的过程。" /> |
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
#include <math.c> | |
int | |
computeDigit(int num) { | |
return 1+(int)log10((float)num); | |
} |
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
beginning-of-line (C-a) | |
Move to the start of the current line. | |
end-of-line (C-e) | |
Move to the end of the line. | |
forward-char (C-f) | |
Move forward a character. | |
backward-char (C-b) |