Skip to content

Instantly share code, notes, and snippets.

class Commenter
constructor: (@author) ->
write: (message) ->
console.log "#{@author}: #{message}"
commenter = new Commenter 'Pablo'
commenter.write 'Hello World'
@phstc
phstc / node-static-test.js
Created June 30, 2012 03:42
vows test/integration/node-static-test.js --spec
var vows = require('vows')
, request = require('request')
, assert = require('assert')
, static = require('../../lib/node-static');
var fileServer = new(static.Server)(__dirname + '/../fixtures', {});
var suite = vows.describe('file-server.js');
var TEST_PORT = 8080;
@phstc
phstc / Legacy.java
Created July 14, 2012 01:19
Refactoring Legacy Code - Removing strong dependencies
/*
* Legacy code with strong dependency with OrderDAO.
*/
public class OrderDAO {
public boolean delete(int id) {
// ...
}
}
public class OrderService {
@phstc
phstc / gist:3765013
Created September 22, 2012 03:25
.irbrc
# Autocomplete
require "irb/completion"
require "rubygems"
require "pp"
# Add all gems installed in the system to the $LOAD_PATH
# so they can be used in Rails console with Bundler
if defined?(::Bundler)
gem_paths = Dir.glob("/usr/local/lib/ruby/gems/1.9.1/gems/**/lib")
gem_paths.each do |path|
@phstc
phstc / gist:3765016
Created September 22, 2012 03:27
.gemrc
---
:verbose: true
:update_sources: true
:backtrace: false
:bulk_threshold: 1000
:benchmark: false
gem: --no-ri --no-rdoc
@phstc
phstc / gist:3805437
Created September 29, 2012 23:52
.pryrc
# Pry.config.editor = "mate -w"
Pry.config.editor = "vim"
Pry.config.prompt = proc do |obj, level, _|
prompt = ""
prompt << "#{Rails.version}@" if defined?(Rails)
prompt << "#{RUBY_VERSION}"
"#{prompt} (#{obj})> "
end
@phstc
phstc / test-twilio.xml
Created November 16, 2012 17:44
test twilio
<?xml version='1.0' encoding='utf-8' ?>
<Response>
<Dial callerId="+5511965056615">
<Number>+5511965056615</Number>
</Dial>
</Response>
@phstc
phstc / gtk-firefox.sh
Created November 20, 2012 22:56
INSTALL FIREFOX ON AMAZON LINUX X86_64 COMPILING GTK+
#!/bin/bash
# GTK+ and Firefox for Amazon Linux
# Written by Joseph Lawson 2012-06-03
# http://joekiller.com
# http://joekiller.com/2012/06/03/install-firefox-on-amazon-linux-x86_64-compiling-gtk/
# chmod 755 ./gtk-firefox.sh
# sudo ./gtk-firefox.sh
### Environment variables ###
export PATH="/usr/local/bin:/usr/local/sbin:/opt/local/bin:/opt/local/sbin:/usr/local/mysql/bin:~:$PATH:."
export CDPATH=".:~:~/projects/personal:~/projects/sandbox"
export LANG="en_US.UTF-8"
export NODE_PATH="/usr/local/lib/node:/usr/local/lib/node_modules"
export CLICOLOR=1
export TERM=xterm-256color
# /usr/bin/notify-site-is-down.rb
require "rubygems"
require "twilio-ruby"
account_sid = ENV["TWILIO_ACCOUNT_SID"]
auth_token = ENV["TWILIO_AUTH_TOKEN"]
@client = Twilio::REST::Client.new account_sid, auth_token