Skip to content

Instantly share code, notes, and snippets.

View neocsr's full-sized avatar

Christian Sousa neocsr

  • Cupertino, CA
  • 03:29 (UTC -12:00)
View GitHub Profile
@neocsr
neocsr / .irbrc
Created January 15, 2011 18:29 — forked from jacqui/gist:770082
irbrc config file forked and edited.
# Forked from jacqui and Iain Hecker, http://iain.nl
# put all this in your ~/.irbrc
# gem install wirble hirb ap interactive_editor
# TODO: Can fail silently if gems are missing.
puts "Loading '#{File.expand_path(__FILE__)}'..."
require 'rubygems'
require 'yaml'
if ($0 == 'irb' && ENV['RAILS_ENV']) || ($0 == 'script/rails' && Rails.env)
@neocsr
neocsr / date_parser.rb.rb
Created January 17, 2011 04:30
Reading a file line by line and parsing each line.
require "date"
new_dates = File.open("new_dates.txt","w")
File.open("old_dates.txt","r") do |f|
while line = f.gets
newdate = DateTime.parse(line)
new_dates << newdate.strftime("%Y-%m-%d %H:%M:%S") << "\n"
end
end
@neocsr
neocsr / .irbrc.rb
Created January 20, 2011 20:46 — forked from rgo/.irbrc.rb
# Forked from Iain Hecker, http://iain.nl
# put all this in your ~/.irbrc
# gem install wirble hirb ap interactive_editor
# TODO: Can fail silently if gems are missing.
puts "Loading '#{File.expand_path(__FILE__)}'..."
require 'rubygems'
require 'yaml'
if ENV['RAILS_ENV']
load File.dirname(__FILE__) + '/.railsrc'
@neocsr
neocsr / ellipsis.rb
Created January 21, 2011 06:19
To limit overflow in table cells.
.ellipsis {
width: 100px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
-o-text-overflow: ellipsis;
-ms-text-overflow: ellipsis;
}
<?php
/**
* Baltimore Locator - an IM, SMS, Twitter and Phone application that finds
* locations in Baltimore.
*
* @copyright 2011 Mark J. Headd (http://www.voiceingov.org)
* @author Mark Headd
*/
@neocsr
neocsr / ruby_setup_mac_osx.plain_text
Created January 24, 2011 03:16
Ruby compilation with readline support (Japanese friendly).
Fixing Snow Leopard Console
http://www.sarahmei.com/blog/2010/01/08/travails-with-readlin/
http://hivelogic.com/articles/compiling-ruby-rubygems-and-rails-on-snow-leopard
curl -O ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p174.tar.gz
cd ~/src
curl -O ftp://ftp.gnu.org/gnu/readline/readline-6.0.tar.gz
tar xzvf readline-6.0.tar.gz
@neocsr
neocsr / .bashrc.plain_text
Created January 26, 2011 02:34
Cygwin bash in Windows
# Environment Variables
# #####################
# TMP and TEMP are defined in the Windows environment. Leaving
# them set to the default Windows temporary directory can have
# unexpected consequences.
unset TMP
unset TEMP
# Alternatively, set them to the Cygwin temporary directory
@neocsr
neocsr / .autotest.rb
Created January 31, 2011 15:25
Autotest with Ruby 1.9
# AUTOTEST config file by @neocsr
# ~/.autotest
def check_and_require_gem(name,with_require)
eval %[if (Gem.available?('#{name}')); require '#{with_require}'; else; puts "#"*40; puts "# Gem '#{name}' not found."; puts "#"*40; end]
end
# Don't use RedGreen with Ruby 1.9 due to MiniTest replacement of UnitTest
if ENV["RSPEC"] || (RUBY_VERSION =~ /1\.9/)
check_and_require_gem('turn','turn')
@neocsr
neocsr / rails_path_patch.rb
Created February 1, 2011 02:20
Add haml support to Textmate bundle in Rails 3
# =================================================
# = Texmate support for Rails 3 bundle navigation =
# =================================================
# ~/Library/Application Support/TextMate/Pristine Copy/Bundles/Ruby on Rails.tmbundle/Support/lib/rails/rails_path.rb
# or
# ~/Library/Application\ Support/TextMate/Bundles/Ruby\ on\ Rails.tmbundle/Support/lib/rails/rails_path.rb
# line 293
def wants_haml
@wants_html ||= File.file?(File.join(rails_root, "vendor/plugins/haml/", "init.rb")) ||
@neocsr
neocsr / about.md
Created August 13, 2011 00:00 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer