Do yourself a favor and put one of these in your machine.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "openssl" | |
require "net/smtp" | |
Net::SMTP.class_eval do | |
private | |
def do_start(helodomain, user, secret, authtype) | |
raise IOError, 'SMTP session already started' if @started | |
check_auth_args user, secret if user or secret | |
sock = timeout(@open_timeout) { TCPSocket.open(@address, @port) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user mauricio users; #this should be the username and the main group of the user that's going to deploy the application | |
worker_processes 4; | |
error_log logs/error.log; | |
pid logs/nginx.pid; | |
events { | |
worker_connections 1024; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: redis-server | |
# Required-Start: $syslog | |
# Required-Stop: $syslog | |
# Should-Start: $local_fs | |
# Should-Stop: $local_fs | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: redis-server - Persistent key-value db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cd /usr/src | |
$ wget http://nginx.org/download/nginx-0.8.52.tar.gz | |
$ tar xzvf ./nginx-0.8.52.tar.gz | |
$ rm ./nginx-0.8.52.tar.gz | |
$ gem install s3sync capistrano capistrano-ext passenger --no-ri --no-rdoc | |
$ passenger-install-nginx-module | |
# Automatically download and install Nginx? 2. No: I want to customize my Nginx installation | |
# Where is your Nginx source code located?: /usr/src/nginx-0.8.52 | |
# Where do you want to install Nginx to?: /opt/nginx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get install openjdk-6-jre-headless | |
wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.17.6.tar.gz -O elasticsearch.tar.gz | |
tar -xf elasticsearch.tar.gz | |
rm elasticsearch.tar.gz | |
sudo mv elasticsearch-0.17.6 elasticsearch | |
sudo mv elasticsearch /usr/local/share | |
wget http://github.com/elasticsearch/elasticsearch-servicewrapper/tarball/master -O - | tar xz | |
mv elasticsearch-elasticsearch-servicewrapper-3e0b23d/service /usr/local/share/elasticsearch/bin/ | |
rm -rv elasticsearch-elasticsearch-servicewrapper-3e0b23d/ | |
sudo /usr/local/share/elasticsearch/bin/service/elasticsearch install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def tip(msg); puts; puts msg; puts "-"*100; end | |
# | |
# 30 Ruby 1.9 Tips, Tricks & Features: | |
# http://www.igvita.com/2011/02/03/new-ruby-19-features-tips-tricks/ | |
# | |
tip "Upgrading to Ruby 1.9 is simple: rvm install 1.9.2 && rvm --default 1.9.2" | |
tip "Ruby 1.9 supports named captures in regular expressions!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
#Formats CSS | |
input, output = ARGV | |
#Input | |
if input == nil or output == nil | |
puts "Syntax: #{$0} [input] [output]" | |
exit | |
end |
Jim Weirich:
This is how I explain it… Ruby has Procs and Lambdas. Procs are created with
Proc.new { }
, lambdas are created withlambda {}
and->() {}
.
In Ruby 1.8,
proc {}
creates lambda, and Ruby 1.9 it creates procs (don't ask).
Lambdas use method semantics when handling parameters, procs use assignment semantics when handling parameters.
This means lambdas, like methods, will raise an ArgumentError when called with fewer arguments than they were defined with. Procs will simply assign nil to variables for arguments that were not passed in.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
require 'restclient' | |
require 'active_support/core_ext/hash' | |
require 'json' | |
require 'hashie' | |
class Path | |
attr_accessor :email | |
attr_accessor :password |
OlderNewer