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

Using Meld merging tool on Mac

  1. Install XQuartz

  2. Install meld with brew

     brew install meld
    
  3. Copy PYTHONPATH

@stormslowly
stormslowly / inherit_in_nodejs
Created January 11, 2014 15:19
nodejs inherit
function Socket(options) {
// ...
stream.Stream.call(this);
// ...
}
util.inherits(Socket, stream.Stream);
@stormslowly
stormslowly / mocha.opts for coffee script
Created January 13, 2014 13:27
use coffee script in mocha option
--compilers coffee:coffee-script
/*
* 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';
@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: {
@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 / 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>
module.exports = {
get: function (req, res) {
res.sendfile(req.path.substr(1));
},
_config: {
rest: false,
shortcuts: false
}
};
@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>
function keepTrying(otherArgs, promise) {
promise = promise||new Promise();
// try doing the important thing
if(success) {
promise.resolve(result);
} else {
setTimeout(function() {
keepTrying(otherArgs, promise);