Skip to content

Instantly share code, notes, and snippets.

View ericzon's full-sized avatar
🏠
Working from home

Eric ericzon

🏠
Working from home
View GitHub Profile
@ryanhanwu
ryanhanwu / README.md
Last active June 17, 2019 14:28
Auto deployment script for CI with Git/Node.JS/Forever

Auto deployment script for CI with Git/Node.JS/Forever

Usage

1.Simply add the deploy.sh to your application folder

2.Start your service

deploy.sh start myApp.js
@julionc
julionc / 00.howto_install_phantomjs.md
Last active March 24, 2025 17:27
How to install PhantomJS on Debian/Ubuntu

How to install PhantomJS on Ubuntu

Version: 1.9.8

Platform: x86_64

First, install or update to the latest system software.

sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev
@jimothyGator
jimothyGator / README.md
Last active July 30, 2025 07:45
Nginx configuration for Mac OS X with Homebrew, using sites-enabled directory.
mkdir -p /usr/local/etc/nginx/sites-{enabled,available}
cd /usr/local/etc/nginx/sites-enabled
ln -s ../sites-available/default.conf
ln -s ../sites-available/default-ssl.conf

File locations:

  • nginx.conf to /usr/local/etc/nginx/
  • default.conf and default-ssl.conf to /usr/local/etc/nginx/sites-available
  • homebrew.mxcl.nginx.plist to /Library/LaunchDaemons/
@morphar
morphar / nodejs-bcrypt-compare.js
Last active February 8, 2018 06:55
A quick speed comparison between bcrypt and bcrypt-nodejs for node.js. bcrypt-nodejs is approximately 3 times as slow as bcrypt. If you try this out yourself, be sure to only run 1 test at a time, to get correct results.
var bcrypt = require('bcrypt');
var bcrypt2 = require('bcrypt-nodejs');
var bcryptHashTests = 10;
var bcryptCompareTests = 10;
/* Generate */
console.time('bcrypt-sync-gen');
@jhogervorst
jhogervorst / jquery.mobile.black-sidebar-theme-readme.md
Last active December 11, 2015 06:19
jQuery Mobile Black Sidebar Theme (for Panels) — Compatible (tested) with jQuery Mobile 1.3.0 (Beta)

Usage

Load this (custom) CSS before the jQuery Mobile CSS, otherwise some styles will not be applied correctly!

Example

 
@mattboon
mattboon / gist:4045215
Created November 9, 2012 11:21
Update WP user_login via SQL
<?php
// Force update our username (user_login)
global $wpdb;
$tablename = $wpdb->prefix . "users";
// method 1
//$sql = $wpdb->prepare("UPDATE %s SET user_login=%s WHERE ID=%d", $tablename, $user_email, $user_id);
//$wpdb->query($sql);
@ElliotChong
ElliotChong / facebookPluginDirectives.coffee
Created October 9, 2012 05:45
Angular directives that will parse Facebook plugins added to the DOM after Facebook has been initialized
module = angular.module 'FacebookPluginDirectives', []
createDirective = (name) ->
module.directive name, ->
restrict: 'C'
link: (scope, element, attributes) ->
FB?.XFBML.parse(element.parent()[0])
createDirective pluginName for pluginName in ['fbActivity', 'fbComments', 'fbFacepile', 'fbLike', 'fbLikeBox', 'fbLiveStream', 'fbLoginButton', 'fbName', 'fbProfilePic', 'fbRecommendations']
@thomseddon
thomseddon / gist:3834721
Created October 4, 2012 16:21
AngularJS: Avoid redirection loop in legacy browser (IE) with HTML5 mode
var buggyAndroid = parseInt((/android (\d+)/.exec(window.navigator.userAgent.toLowerCase()) || [])[1], 10) < 4;
if (!history.pushState || buggyAndroid) {
if (window.location.hash) {
if(window.location.pathname !== '/') window.location.replace('/#!' + window.location.hash.substr(2)); //Hash and a path, just keep the hash (redirect)
} else {
window.location.replace('/#!' + window.location.pathname); //No hash, take path
}
}
//And then in app.config:
@jinze
jinze / forever-initd-example.sh
Created September 19, 2012 09:50
forever init.d example
#!/bin/bash
#
# initd-example Node init.d
#
# chkconfig: 345 80 20
# description: Node init.d example
# processname: node
# pidfile: /var/run/initd-example.pid
# logfile: /var/log/initd-example.log
#
@Mithrandir0x
Mithrandir0x / gist:3639232
Created September 5, 2012 16:15
Difference between Service, Factory and Provider in AngularJS
// Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc
// jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/
// author: Pawel Kozlowski
var myApp = angular.module('myApp', []);
//service style, probably the simplest one
myApp.service('helloWorldFromService', function() {
this.sayHello = function() {
return "Hello, World!"