Skip to content

Instantly share code, notes, and snippets.

View kathgironpe's full-sized avatar

Katherine Giron Pe kathgironpe

View GitHub Profile
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) }
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;
}
#! /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
@kathgironpe
kathgironpe / installation.sh
Created July 20, 2011 11:52 — forked from mikhailov/installation.sh
Nginx+passenger application config: ssl redirection, http headers, passenger optimal settings. see details: http://mikhailov.posterous.com/nginx
$ 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
@kathgironpe
kathgironpe / .0.md
Created September 8, 2011 14:26 — forked from rstacruz/.0.md

Stop littering your gitignores

Do yourself a favor and put one of these in your machine.

@kathgironpe
kathgironpe / elasticsearch-install.sh
Created February 29, 2012 12:58 — forked from quinn/elasticsearch-install.sh
install elasticsearch on ubuntu
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
@kathgironpe
kathgironpe / ruby-1.9-tips.rb
Created August 11, 2012 16:15 — forked from igrigorik/ruby-1.9-tips.rb
Ruby 1.9 features, tips & tricks you may not know about...
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!"
#!/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 with lambda {} 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.

@kathgironpe
kathgironpe / path.rb
Created January 19, 2013 07:11 — forked from anonymous/path.rb
# -*- coding: utf-8 -*-
require 'restclient'
require 'active_support/core_ext/hash'
require 'json'
require 'hashie'
class Path
attr_accessor :email
attr_accessor :password