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
# Profiler starts | |
require 'ruby-prof' | |
RubyProf.start | |
@return_data = your_method(@your_data) | |
result = RubyProf.stop | |
printer = RubyProf::GraphHtmlPrinter.new(result) | |
path = File.join(RAILS_ROOT, 'public', 'profiling_output.html') |
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
/LOG OPEN -targets #railsconf ~/irclogs/railsconf/railsconf_%Y-%m-%d | |
/LOG OPEN -targets #fana ~/irclogs/fanalog-%Y-%m-%d [encrypted] |
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
upstream planetrubyonrails.net { | |
server 127.0.0.1:8014; | |
server 127.0.0.1:8015; | |
} | |
server { | |
listen 80; | |
server_name planetrubyonrails.net; | |
#rewrite ^/(.*) http://planetrubyonrails.net permanent; |
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
# Useful s3 commands | |
s3sync -r docs anilwadghule: |
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
CmdUtils.CreateCommand({ | |
name: "page-width", | |
author: { name: "Jacky See"}, | |
license: "GPL", | |
description: "Limit the page width by a given parameter, align it to center", | |
help: "e.g. page-width 400", | |
takes: {"input": noun_arb_text}, | |
preview: function( pblock, input ) { | |
var template = "Setting page to width ${w} (default is 500)"; | |
var width = 500; //default width |
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
var checkboxes = YAHOO.util.Selector.query("input[type=checkbox]", "add_from_address_book"); | |
var length = checkboxes.length; | |
for(var i=0; i < length; i++) { | |
checkboxes[i].checked = true; | |
} |
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
With: | |
require 'bleak_house' | |
mongrel_rails start | |
Error comes: | |
This build of Ruby has not been successfully patched for BleakHouse. | |
$ ruby -v | |
ruby 1.8.6 (2007-06-07 patchlevel 36) [i486-linux] |
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 gem install bleak_house | |
Building native extensions. This could take a while... | |
ERROR: Error installing bleak_house: | |
ERROR: Failed to build gem native extension. | |
/usr/bin/ruby1.8 extconf.rb install bleak_house | |
extconf.rb:3:in `exec': No such file or directory - ruby-bleak-house build_snapshot.rb (Errno::ENOENT) | |
from extconf.rb:3 | |
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
# my new favorite bashrc function | |
# quickly inspect source files in style | |
function pless { | |
pygmentize $1 | less -r | |
} | |
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
class Array | |
def second | |
self[1] | |
end | |
end |