Skip to content

Instantly share code, notes, and snippets.

View thisivan's full-sized avatar

Ivan Torres thisivan

View GitHub Profile
@thisivan
thisivan / environment.rb
Created May 6, 2011 19:35
Take the abbreviated commit hash as the RAILS_ASSET_ID value
ENV['RAILS_ASSET_ID'] = `git log -1 --pretty=format:"%h"`
@thisivan
thisivan / .screenrc
Created February 14, 2011 05:47
My GNU Screen configuration file
term "screen-256color"
defscrollback 10000
bind y eval "writebuf" "exec sh -c 'pbcopy < /tmp/screen-exchange'"
@thisivan
thisivan / gist:823572
Created February 12, 2011 07:05
Concentrate (http://getconcentrating.com) Pomodoro AppleScripts
(* Setup this script to run when a "Pomodoro" activity has finished. It will start either "Pomodoro Break" or "Pomodoro Long Break" when finished *)
set activity1 to "Pomodoro Break"
set activity2 to "Pomodoro Long Break"
set button3 to "Stop Working"
set dialogText to "What do you want to do now?"
set dialogTitle to "Choose your next step..."
@thisivan
thisivan / .zshrc
Created February 11, 2011 22:07
Enable Vim mode in ZSH
# Enable Vim mode in ZSH
bindkey -v
autoload -U edit-command-line
zle -N edit-command-line
bindkey '^E' edit-command-line # Opens Vim to edit current command line
bindkey '^R' history-incremental-search-backward # Perform backward search in command line history
bindkey '^S' history-incremental-search-forward # Perform forward search in command line history
bindkey '^P' history-search-backward # Go back/search in history (autocomplete)
bindkey '^N' history-search-forward # Go forward/search in history (autocomplete)
@thisivan
thisivan / rest_calc.js
Created November 4, 2010 17:13
The code from the talk I gave today about Node.js
/*
* Rest Calculator Server
*
* Based on "Building a Simple Web Service" screencast
* from thinkvitamin.com
*/
var util = require('util'),
http = require('http');
require "autotest/growl" # only for Mac
require "autotest/fsevent" # only for Mac
require "autotest/restart" # restart autotest when this file changes
# Don't reset terminal when finished test
Autotest::Growl::clear_terminal = false # only for Mac
Autotest.add_hook :initialize do |autotest|
# Ignore the following files
require "autotest/growl" # only for Mac
require "autotest/fsevent" # only for Mac
require "autotest/restart" # restart autotest when this file changes
# Don't reset terminal when finished test
Autotest::Growl::clear_terminal = false # only for Mac
Autotest.add_hook :initialize do |autotest|
# Ignore the following files
# RVM bootstrap
$:.unshift(File.expand_path("~/.rvm/lib"))
require 'rvm/capistrano'
set :rvm_ruby_string, '1.8.7'
# main details
set :application, "fctableros"
role :web, "your_web_server_ip_or_domain"
role :app, "your_app_server_ip_or_domain"
role :db, "your_db_server_ip_or_domain", :primary => true
// make sure curl is installed
if (function_exists('curl_init')) {
// initialize a new curl resource
$ch = curl_init();
// set the url to fetch
curl_setopt($ch, CURLOPT_URL, $_GET['tracking_lead_uri']);
}
begin
open(params[:tracking_lead_uri])
rescue OpenURI::HTTPError
puts "Couldn't make your request."
end