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 new | |
@ps = ProductSpecification.find(params[:spec]) | |
@product_request = ProductRequest.new(:height => @ps.height, :width => @ps.width) | |
respond_to do |format| | |
format.html # new.html.erb | |
format.xml { render :xml => @product_request } | |
end | |
end |
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
function parse_git_dirty { | |
git diff --quiet || echo "^" | |
} | |
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)] /" | |
} | |
export PS1='\w $(parse_git_branch)\$ ' |
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
# App Template | |
# By Matt Polito | |
# Link to local copy of edge rails | |
rake('rails:freeze:gems') | |
# Delete unnecessary files | |
run "rm README" | |
run "rm public/index.html" | |
run "rm public/favicon.ico" |
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
# note: rack.input == the request body | |
>> env = { "REQUEST_METHOD" => "GET", "REQUEST_URI"=>"/events", "QUERY_STRING" => "", "rack.input" => ""} | |
=> {...} | |
>> response = EventsController.call(env) | |
=> #<ActionController::Response:0x22eb95c ...> | |
>> puts response.body | |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
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
document.observe("dom:loaded", function() { | |
function updateElementsWithTime() { | |
$$("span[time]").invoke('updateTime') | |
} | |
// update immediately | |
updateElementsWithTime() | |
// continue updating every 2 minutes | |
new PeriodicalExecuter(updateElementsWithTime, 60 * 2) | |
}) |
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
// some javascript... trying to learn... syntax so weird... | |
var a = { | |
foo: function() { alert('yo mama!!'); } | |
}; | |
var box = { | |
height: 50, | |
width: 200 |
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 port install -u git-core +svn +bash_completion |
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
/** | |
* Cheating on http://clickthatbutton.com/ | |
*/ | |
cheat = function() { $.post("/", {submit : {x : 193, y: 52}}, doResponse) }; setInterval(cheat, 1000); |
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
# confusing behavior with attr_readonly | |
# setup - we're going to create a user with an attr_readonly attribute: "login" | |
~/working/$ rails -v | |
Rails 2.3.0 | |
~/working $ rails rails | |
~/working $ cd rails | |
~/working/rails $ script/generate model user login:string | |
~/working/rails $ rake db:migrate |
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
[Tekkub@KAKU: ~/tmp/mach_star master]$ gem install rtomayko-rack-contrib | |
Building native extensions. This could take a while... | |
ERROR: Error installing rtomayko-rack-contrib: | |
ERROR: Failed to build gem native extension. | |
c:/ruby/bin/ruby.exe extconf.rb install rtomayko-rack-contrib | |
creating Makefile | |
nmake | |
'nmake' is not recognized as an internal or external command, |