Skip to content

Instantly share code, notes, and snippets.

MacOS

Download from here:

http://d.pr/f/QE3d

MD5: 59bab8f71f8c096cd3f72cd73851515d

Rename it to:

@soyuka
soyuka / pm2-init.sh
Last active August 29, 2015 13:56
PM2 update-rc.d
#!/bin/bash
# chkconfig: 2345 98 02
#
# description: PM2 next gen process manager for Node.js
# processname: pm2
#
### BEGIN INIT INFO
# Provides: pm2
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
@soyuka
soyuka / gist:9296111
Created March 1, 2014 19:52
basic daemon.sh
d_start() {
}
d_stop() {
}
case "$1" in
@soyuka
soyuka / app.js
Created March 10, 2014 20:47
Angular js keeping the hash anchor navigation with html5mode router
app.config(function($stateProvider, $urlRouterProvider, $locationProvider) {
$locationProvider.hashPrefix('!').html5Mode(true)
})
app.run(function($rootScope, $location) {
$rootScope.$on('$locationChangeStart', function(e, next, current) {
//prevent first load
@soyuka
soyuka / index.js
Created March 24, 2014 22:41
Expressjs 4.0.0-rc3 - middlewares + sub router issue
process.env.DEBUG = '*'
var express = require('express')
var app = express()
var middleware = function(req, res, next) {
console.log('Trying to put a middleware here')
next(null)
},
@soyuka
soyuka / ezseed
Created March 26, 2014 08:15
Ezseed2 apache
<VirtualHost *:80>
ServerAdmin infos@soyuka.me
ServerName localhost
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@soyuka
soyuka / misc.sh
Created April 4, 2014 07:17
pm2 misc.sh
#!/usr/bin/env bash
SRC=$(cd $(dirname "$0"); pwd)
source "${SRC}/include.sh"
cd $file_path
echo -e "\033[1mRunning tests:\033[0m"
var express = require('express');
var app = express();
var reg = /^[a-z]+$/;
app.use(require('body-parser')());
var param = function(req, res, next, val) {
return val.match(reg) ? next() : next(new Error(val + ' is not a valid param'))
}
// Callback hell
do.this(function(callback) {
then.do.that(function() {
then.end(function() {
callback()
})