Skip to content

Instantly share code, notes, and snippets.

View coffeesam's full-sized avatar
:octocat:
GitHubbing..

Sam Hon coffeesam

:octocat:
GitHubbing..
View GitHub Profile
@coffeesam
coffeesam / gist:1372698
Created November 17, 2011 08:35 — forked from tung/gist:409780
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
BLUE="\[\033[0;34m\]"
LIGHT_RED="\[\033[1;31m\]"
LIGHT_GREEN="\[\033[1;32m\]"
WHITE="\[\033[1;37m\]"
LIGHT_GRAY="\[\033[0;37m\]"
COLOR_NONE="\[\e[0m\]"
@coffeesam
coffeesam / Gemfile
Created December 8, 2011 22:08 — forked from mislav/Gemfile
How to integrate Compass with Rails 3.1 asset pipeline
group :assets do
gem 'sass-rails', '~> 3.1.0'
gem 'coffee-rails', '~> 3.1.0'
gem 'uglifier'
gem 'compass'
end
@coffeesam
coffeesam / appify
Created August 2, 2012 06:29 — forked from mathiasbynens/appify
appify — create the simplest possible Mac app from a shell script
#!/bin/bash
if [ "$1" = "-h" -o "$1" = "--help" -o -z "$1" ]; then cat <<EOF
appify v3.0.1 for Mac OS X - http://mths.be/appify
Creates the simplest possible Mac app from a shell script.
Appify takes a shell script as its first argument:
`basename "$0"` my-script.sh
@coffeesam
coffeesam / process.txt
Created August 8, 2012 04:47
AppJS bundle app.exe process dump
{ title: 'Command Prompt - bin\\node.exe -e "console.log(process)" ',
version: 'v0.8.2',
moduleLoadList:
[ 'Binding evals',
'Binding natives',
'NativeModule events',
'NativeModule buffer',
'Binding buffer',
'NativeModule assert',
'NativeModule util',
@coffeesam
coffeesam / commands.md
Created August 22, 2012 01:45 — forked from maddox/commands.md
Install script for Samba3

Install Samba 3 on OS X 10.7 Lion

Run the two commands below one at a time to get Samba 3 installed and to have it run on boot.

Install Samba with Homebrew

sh < <(curl https://raw.github.com/gist/1938575/df254d9a2ac83dddb04fcc7f9b634b65708aa477/

Set Samba up to launch on boot

require 'yaml'
namespace :pg do
namespace :mac do
def conf
@conf ||= YAML.load_file("#{Rails.root}/config/database.yml")
end
def username
/**
* Return a timestamp with the format "m/d/yy h:MM:ss TT"
* @type {Date}
*/
function timeStamp() {
// Create a date object with the current time
var now = new Date();
// Create an array with the current month, day and time
require "rspec/core/formatters/progress_formatter"
class ApplauseFormatter < RSpec::Core::Formatters::ProgressFormatter
def initialize(output)
super(output)
unless File.exists? "/tmp/applause.mp3"
p "Downloading applause for awesomeness"
system "wget http://www.soundjay.com/human/applause-1.mp3 -O /tmp/applause.mp3"
end
end
@coffeesam
coffeesam / gist:5745973
Last active December 18, 2015 07:19
queue-async sample
var queue = require('queue-async');
var q = queue(1); // one concurrent task
// Queue 2 task and define completion call back
q.defer(setTimeout, function(callback) { console.log('job 1'); callback(null);}, 1000)
.defer(setTimeout, function(callback) { console.log('job 2'); callback(null); }, 1000)
.awaitAll(function(error, results) { console.log('all done!'); } );
// Queue 2 more tasks before completion kicks in
q.defer(setTimeout, function(callback) { console.log('job 3'); callback(null);}, 1000);