Skip to content

Instantly share code, notes, and snippets.

View michealbenedict's full-sized avatar

Micheal michealbenedict

View GitHub Profile
#! /bin/sh
CUR_DIR=$PWD
PID_FILE="$CUR_DIR/node.pid"
if [ $1 = "start" ]; then
if [ -e $PID_FILE ]; then
echo "Node.js is already running."
else
echo "Starting Node Server"
@michealbenedict
michealbenedict / .gitignore
Created May 18, 2011 19:38 — forked from weaver/.gitignore
Express + Formidable, works with bodyParser and sets req.body correctly.
node_modules
@michealbenedict
michealbenedict / gist:1018691
Created June 10, 2011 11:50 — forked from paulirish/gist:366184
html5 geolocation with fallback.
// geo-location shim
// currentely only serves lat/long
// depends on jQuery
;(function(geolocation){
if (geolocation) return;
var cache;
@michealbenedict
michealbenedict / short_code_generator.js
Created June 16, 2011 06:51 — forked from csanz/short_code_generator.js
Just a simple, mini short code generator.
// For Nodejs
const crypto = require('crypto');
/**
* Get Short Code
*
* Mini Short Code Generator
*
* @param {Number} size
@michealbenedict
michealbenedict / comma-first-var.js
Created June 17, 2011 11:08 — forked from isaacs/comma-first-var.js
A better coding convention for lists and object literals in JavaScript
// See comments below.
// This code sample and justification brought to you by
// Isaac Z. Schlueter, aka isaacs
// standard style
var a = "ape",
b = "bat",
c = "cat",
d = "dog",
@michealbenedict
michealbenedict / gist:1164300
Created August 23, 2011 03:44 — forked from nzakas/gist:1164118
Ant target for autogenerating changelog based on Git tags
<!--
Ant target for autogenerating a changelog based on Git tags
Workflow:
1. Do all of your checkins for a given version.
2. When you're ready to officially create a new version, tag it using git tag, such as "git tag v0.3.0".
3. If you don't already have a file named CHANGELOG in the root directory, make one.
4. Run "ant changelog.update"
@michealbenedict
michealbenedict / github_post_commit.js
Created August 27, 2011 17:36 — forked from blindsey/github_post_commit.js
node.js auto deploy scripts
Steps:
0. Checkout your git repo from the server (I use /var/www/carbonite)
1. Upload both of these files to the same directory on your server
2. chmod +x restart_node.sh
3. nohup node github_post_commit.js 2>&1 >> github_post_commit.log &
4. In the github admin for your repo, set a post commit hook to the url http://<your host>:8080/
5. Make a commit to your repo
6. Point a browser at http://<your host>:8080/ and you should see the commit
@michealbenedict
michealbenedict / LICENSE.txt
Created November 2, 2011 18:24 — forked from jed/LICENSE.txt
write contextual templates
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@michealbenedict
michealbenedict / ruby-class.js
Created November 25, 2011 20:12
Ruby-style classes in ECMAScript 5
var Class = Object.create(null, {
"new": {
"value": function () {
var result = Object.create(this, {
"class": {
"value": this
}
});
result.initialize.apply(result, arguments);
return result;
@michealbenedict
michealbenedict / jquery.ba-tinypubsub.js
Created December 12, 2011 20:37 — forked from cowboy/HEY-YOU.md
jQuery Tiny Pub/Sub: A really, really, REALLY tiny pub/sub implementation for jQuery.
/* jQuery Tiny Pub/Sub - v0.7 - 10/27/2011
* http://benalman.com/
* Copyright (c) 2011 "Cowboy" Ben Alman; Licensed MIT, GPL */
(function($) {
var o = $({});
$.subscribe = function() {
o.on.apply(o, arguments);