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
begin | |
@tweet = Twitter.user_timeline("xxx").first.text | |
rescue | |
@tweet = "Twitter is down :(" | |
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
ArgumentError: wrong number of arguments (3 for 2) | |
from /Users/danhunter/.rvm/gems/ruby-1.9.3-p125/gems/youtube_it-2.1.7/lib/youtube_it/middleware/faraday_oauth2.rb:9:in `initialize' | |
from /Users/danhunter/.rvm/gems/ruby-1.9.3-p125/gems/faraday-0.8.4/lib/faraday/middleware.rb:21:in `new' | |
from /Users/danhunter/.rvm/gems/ruby-1.9.3-p125/gems/faraday-0.8.4/lib/faraday/middleware.rb:21:in `new' | |
from /Users/danhunter/.rvm/gems/ruby-1.9.3-p125/gems/faraday-0.8.4/lib/faraday/builder.rb:43:in `build' | |
from /Users/danhunter/.rvm/gems/ruby-1.9.3-p125/gems/faraday-0.8.4/lib/faraday/builder.rb:78:in `block in to_app' | |
from /Users/danhunter/.rvm/gems/ruby-1.9.3-p125/gems/faraday-0.8.4/lib/faraday/builder.rb:78:in `each' | |
from /Users/danhunter/.rvm/gems/ruby-1.9.3-p125/gems/faraday-0.8.4/lib/faraday/builder.rb:78:in `inject' | |
from /Users/danhunter/.rvm/gems/ruby-1.9.3-p125/gems/faraday-0.8.4/lib/faraday/builder.rb:78:in `to_app' | |
from /Users/danhunter/.rvm/gems/ruby-1.9.3-p125/gems/faraday-0.8.4/lib/faraday/connection.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
- @categories.each do |category| | |
- category.subcategories.each do |subcategory| | |
- subcategory.users.each do |user| | |
= image_tag user.profile.avatar.url(:medium) |
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
# This.. | |
Category.first.users | |
# ..generates this: | |
SELECT "users".* FROM "users" INNER JOIN "categorizations" ON "users"."id" = "categorizations"."user_id" INNER JOIN "subcategories" ON "categorizations"."subcategory_id" = "subcategories"."id" WHERE "subcategories"."category_id" = 1 | |
# Is there something like this.. |
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 Category < ActiveRecord::Base | |
has_many :subcategories, :dependent => :destroy | |
has_many :users, :through => :subcategories | |
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() { | |
var avatar_uploader = new plupload.Uploader({ | |
runtimes: 'html5,flash,html4', | |
container : 'avatar-upload', | |
browse_button : 'avatar-browse', | |
url : '<%= upload_image_user_path %>', | |
max_file_size: '10mb', | |
multiple_queues: true, | |
flash_swf_url : '/plupload/plupload.flash.swf', | |
multipart: 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
def origin | |
purchase_order.shipper.location if purchase_order.shipper | |
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
# in config/initializers/foo.rb | |
Media.send :include, MediaConcern | |
# in concerns/media_concern.rb | |
require 'active_support/concern' | |
module MediaConcern | |
extend ActiveSupport::Concern | |
included do |
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
c_path=`tput setaf 6` | |
c_stgd=`tput setaf 2` | |
c_unstgd=`tput setaf 9` | |
c_sgr0=`tput sgr0` | |
parse_git_branch () | |
{ | |
if git rev-parse --git-dir >/dev/null 2>&1 | |
then | |
gitver=$(git branch 2>/dev/null| sed -n '/^\*/s/^\* //p') |
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
day_of_month | count | |
--------------+------- | |
1 | 20 | |
2 | 43 | |
3 | 42 | |
4 | 32 | |
5 | 22 | |
6 | 19 | |
7 | 39 | |
8 | 32 |
OlderNewer