Skip to content

Instantly share code, notes, and snippets.

View stormslowly's full-sized avatar
🎯
Focusing

pshu stormslowly

🎯
Focusing
  • Hangzhou, Zhejiang, China
View GitHub Profile
@stormslowly
stormslowly / MakeGraphDependencies.java
Created July 4, 2014 03:07
MakeGraphDependencies
/**
* steal from: https://raw.githubusercontent.com/lindenb/jsandbox/master/src/sandbox/MakeGraphDependencies.java
* thanks a lot
*/
package sandbox;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
@stormslowly
stormslowly / prepare.md
Last active August 29, 2015 14:03
node 准备工作

周五node分享会,大家有空提前准备一些东西

(1) 先到下面的链接 找对应文件的node安装文件安装。

http://nodejs.org/dist/v0.10.22/

在命令行

$ node -v
"use strict";
// `f` is assumed to sporadically fail with `TemporaryNetworkError` instances.
// If one of those happens, we want to retry until it doesn't.
// If `f` fails with something else, then we should re-throw: we don't know how to handle that, and it's a
// sign something went wrong. Since `f` is a good promise-returning function, it only ever fulfills or rejects;
// it has no synchronous behavior (e.g. throwing).
function dontGiveUp(f) {
return f().then(
undefined, // pass through success
function keepTrying(otherArgs, promise) {
promise = promise||new Promise();
// try doing the important thing
if(success) {
promise.resolve(result);
} else {
setTimeout(function() {
keepTrying(otherArgs, promise);
@stormslowly
stormslowly / bootstrap-navbar.html
Created June 16, 2014 12:19
bootstrap navbar template
<nav class="navbar navbar-default" role="navigation">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Brand</a>
module.exports = {
get: function (req, res) {
res.sendfile(req.path.substr(1));
},
_config: {
rest: false,
shortcuts: false
}
};
@stormslowly
stormslowly / index.html
Created June 16, 2014 04:42
html start template
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Enter your title here</title>
<link rel="stylesheet" href="styles/main.css">
</head>
<body>
@stormslowly
stormslowly / meta_viewport.snippet
Last active August 29, 2015 14:02
viewport meta
<meta name="viewport" content="width=device-width, initial-scale=1">
@stormslowly
stormslowly / Gruntfile.js
Created May 26, 2014 08:27
Grunt-live-reload
'use strict';
/*global module:false , require:false*/
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
// Task configuration.
connect: {
options: {
/*
* Inspired by: http://stackoverflow.com/questions/4360060/video-streaming-with-html-5-via-node-js
*/
var http = require('http'),
fs = require('fs'),
util = require('util');
http.createServer(function (req, res) {
var path = 'video.mp4';