Skip to content

Instantly share code, notes, and snippets.

View nickleefly's full-sized avatar

Xiuyu Li nickleefly

  • Shanghai
View GitHub Profile
@nickleefly
nickleefly / answers.md
Created February 27, 2014 02:53 — forked from jpsim/answers.md
  1. Plain Strings (207): foo
  2. Anchors (208): k$
  3. Ranges (202): ^[a-f]*$
  4. Backrefs (201): (...).*\1
  5. Abba (169): ^(.(?!(ll|ss|mm|rr|tt|ff|cc|bb)))*$|^n|ef
  6. A man, a plan (177): ^(.)[^p].*\1$
  7. Prime (286): ^(?!(..+)\1+$)
  8. Four (199): (.)(.\1){3}
  9. Order (198): ^[^o].....?$
  10. Triples (507): (^39|^44)|(^([0369]|([147][0369]*[258])|(([258]|[147][0369]*[147])([0369]*|[258][0369]*[147])([147]|[258][0369]*[258])))*$)
@nickleefly
nickleefly / tabletop.html
Last active August 29, 2015 13:57
save a console output to a file
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="description" content="TimelineJS example">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-touch-fullscreen" content="yes">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<!-- jQuery -->
@nickleefly
nickleefly / hello.go
Created March 24, 2014 03:14
webserver in go lang
package main
import (
"fmt"
"log"
"net/http"
)
func sayHello(responseWriter http.ResponseWriter, request *http.Request) {
request.ParseForm() //解析表单参数
@nickleefly
nickleefly / index.js
Created May 22, 2014 17:01
requirebin sketch
// example using the raf module from npm. try changing some values!
var requestAnimationFrame = require("raf")
var canvas = document.createElement("canvas")
canvas.width = 500
canvas.height = 500
document.body.appendChild(canvas)
var context = canvas.getContext("2d")
@nickleefly
nickleefly / index.js
Created May 31, 2014 07:20
requirebin sketch
var moment = require('moment')
var data = {y: 2010, M: 3, d: 5, h: 15, m: 10, s: 3, ms: 123}
var result = moment(data).format('YYYY-MM-DD')
console.log(result)

browserify data-plumber levelmeup nodebot bug-clinic goingnative makemehapi npm-tutor shader-school

@nickleefly
nickleefly / streamout.js
Created August 21, 2014 00:40
stream data into a file
var fs = require('fs')
var wstream = fs.createWriteStream('myfile.csv')
wstream.write('id, title, rating, zipcode\n')
wstream.write('1, my title, 5, 94402\n')
wstream.end()
@nickleefly
nickleefly / stream-write.js
Last active August 29, 2015 14:05
writeStream create data
var GraphModel = require('../models/graphModel.js');
var fs = require('fs');
var moment = require('moment');
/**
Provides the controllers for the application views
@module api/controllers
**/
exports.controller = function(req, res) {
@nickleefly
nickleefly / mixins.styl
Last active August 29, 2015 14:11
stylus usage 'stylus < my.styl'
border-radius()
-webkit-border-radius: arguments
-moz-border-radius: arguments
border-radius: arguments
git branch -vv --color=always | while read; do echo -e $(git log -1 --format=%ci $(echo "_$REPLY" | awk '{print $2}' | perl -pe 's/\e\[?.*?[\@-~]//g') 2> /dev/null || git log -1 --format=%ci)" $REPLY"; done | sort -r | cut -d ' ' -f -1,4-

git for-each-ref --format='%(committerdate:iso8601) %(committerdate:relative) %(refname)' --sort -committerdate
git for-each-ref --format='%(committerdate:iso8601) %(committerdate:relative) %(refname)' --sort -committerdate refs/heads/
git for-each-ref --format='%(committerdate:short),%(authorname),%(refname:short)' --sort=committerdate refs/heads/ | column -t -s ','

for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ci %cr" $branch | head -n 1` \\t$branch; done | sort -r
for branch in `git branch -l | grep -v '*'`;do echo -e `git show --format="%ci %cr" $branch | head -n 1` \\t$branch; done | sort -r