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
@modelos = Modelo.all(:params => {:client => @client_code}) |
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
$ rails console | |
Loading development environment (Rails 3.0.6) | |
ruby-1.8.7-p334 :001 > r = Rails.application.routes | |
Gives you a handle of all the routes (config/routes.rb) | |
#Inspect a named route: | |
ruby-1.8.7-p334 :005 > r.recognize_path(app.destroy_user_session_path) | |
=> {:action=>"destroy", :controller=>"sessions"} |
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
%w[sinatra dm-core dm-migrations slim sass].each{ |lib| require lib } | |
DataMapper.setup(:default, ENV['DATABASE_URL'] || File.join("sqlite3://",settings.root, "development.db")) | |
class Robot | |
include DataMapper::Resource | |
property :id, Serial | |
property :top, Integer, :default => proc { 1+rand(6) } | |
property :middle, Integer, :default => proc { 1+rand(4) } | |
property :bottom, Integer, :default => proc { 1+rand(5) } |
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
#!/bin/bash | |
# | |
# DESCRIPTION: | |
# | |
# Set the bash prompt according to: | |
# * the branch/status of the current git/svn repository | |
# * the return value of the previous command | |
# * the current rvm ruby version and gemset (or plain ruby, check parse_ruby_version function) | |
# | |
# USAGE: |
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
browser = request.user_agent.browser | |
version = request.user_agent.version and int(request.user_agent.version.split('.')[0]) | |
platform = request.user_agent.platform | |
uas = request.user_agent.string | |
if browser and version: | |
if (browser == 'msie' and version < 9) \ | |
or (browser == 'firefox' and version < 4) \ | |
or (platform == 'android' and browser == 'safari' and version < 534) \ | |
or (platform == 'iphone' and browser == 'safari' and version < 7000) \ |
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
// Make it Nasty | |
function increment (i) { | |
i ^= (i & ~-~i) | (~i & -~i) | |
return i | |
} |
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
// write a function that takes an argument | |
// and returns that argument. | |
function identity(x) { | |
return x; | |
} | |
// write two binary functions, add and mul, | |
// that take two numbers and return their sum and product. |
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
Colleagues don't let colleagues code sober. | |
=========== | |
= Spirits = | |
=========== | |
- Santa Teresa 1796 rum | |
- Black Maple Hill bourbon | |
- Bruichladdich Rocks scotch | |
- Templeton rye | |
- Whistlepig Straight Rye Whiskey |
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
/* ******************************************************************************************* | |
* THE UPDATED VERSION IS AVAILABLE AT | |
* https://github.com/LeCoupa/awesome-cheatsheets | |
* ******************************************************************************************* */ | |
// 0. Synopsis. | |
// http://nodejs.org/api/synopsis.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
/* and now with 100% more branding */ | |
body { border: 10px solid #82FA32; min-height: 720px; } | |
.container { width: inherit; } | |
.header { display: none; } | |
.gh-header { padding: 30px 0px 30px 0px; background-color: black; color: white; } | |
.gh-header-actions { float: inherit; text-align: center; } | |
.btn-primary { border-color: #000; background-image: linear-gradient(#333, #000); } | |
.gh-header-actions .btn { float: inherit; } | |
.gh-header-title { padding-top: 20px; text-align: center; font-size: 4.2em; margin-right: 0px; font-weight: 100; } | |
.pagehead { display: none; } |
OlderNewer