Skip to content

Instantly share code, notes, and snippets.

View layerssss's full-sized avatar

Michael Yin layerssss

View GitHub Profile
@layerssss
layerssss / trygist.js
Created June 13, 2012 04:31
have a try on gist
gist.hello({
salutation:'hi'
});
@layerssss
layerssss / _z_example.iced
Last active December 10, 2015 23:19
handler error in `iced-coffee-script`
fs = require 'fs'
_z = (errcb, cb)->
return ()->
return errcb.apply null, arguments if arguments[0]
return cb.apply null, arguments
myfunc = (handler) -> # like `app.get '/', (req, res, next)->` in `express`
handler 'dummy1', 'dummy2', 'dummy3', 'dummy4', (err, data)->
# Usage: `curl https://gist.github.com/raw/4618705/mirror.sh | sh`
rm -Rf /srv/mdn.micy.in.new
wget \
--recursive \
--level=3 \
--wait=1 \
--adjust-extension \
--convert-links \
--backup-converted \
var x;
var y;
if (e.pageX || e.pageY) {
x = e.pageX;
y = e.pageY;
}
else {
x = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
y = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
# usage: curl https://gist.github.com/raw/4631928/mirrornodejsdoc.sh | sh
wget \
--recursive \
--level=5 \
--adjust-extension \
--convert-links \
--backup-converted \
--no-host-directories \
--page-requisites \
--timestamping \
@layerssss
layerssss / Makefile
Created March 7, 2013 03:41
sample makefile for nodejs project
all: components node_modules
components: node_modules component.json
node_modules/bower/bin/bower install
touch $@
node_modules: package.json
npm install
touch $@
clean:
@layerssss
layerssss / install_nodejs_linux_x64.sh
Last active December 14, 2015 15:08
for pity ubuntu users....
#!/usr/bin/env sh
# install nodejs on linux x64.
# usage:
# curl 'https://gist.github.com/layerssss/5105454/raw/install_nodejs_linux_x64.sh' | sudo bash
NODE=`curl http://nodejs.org/dist/latest/ | perl -ne 'while(/\"(node[^\"]*linux-x64).tar.gz"/g){print "$1\n";}'`
echo Installing $NODE ...
curl http://nodejs.org/dist/latest/$NODE.tar.gz -o ./node.tar.gz
tar xvzf node.tar.gz

touchy

试一试 [试一试](javascript:var script;document.body.appendChild(script=document.createElement('script'));script.setAttribute('src','https://raw.github.com/layerssss/touchy/touchy.js'))

Jade - 模板引擎

Jade 是一个高性能的模板引擎,它深受Haml影响,它是用javascript实现的,并且可以供node使用.

svg.selectAll "polygon",
data: [polyData]
enter:
append: 'polygon'
style:
"stroke": "gray"
"stroke-width": 2
"fill": 'none'

hello

a = (a)->
  alert 'haha