This file contains hidden or 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
| describe '#instances' do | |
| it 'should return all instances of a class currently present in the Ruby ObjectSpace' do | |
| klass = Class.new | |
| some_instances = [klass.new, klass.new, klass.new] | |
| some_instances.each {|instance| klass.instances.should include(instance) } | |
| end | |
| end |
This file contains hidden or 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
| precmd() { | |
| local branch_ref branchless_ref | |
| psvar=() | |
| branch_ref=$(git symbolic-ref -q HEAD 2>/dev/null) | |
| cleanliness="" | |
| if [[ ! -z $(git diff-index --name-only HEAD 2>/dev/null) ]]; then | |
| cleanliness="*" | |
| fi | |
| # We might be on a checked out branch: |
This file contains hidden or 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/sh | |
| # ------------------------------------------------------------------------ | |
| # colorwrap | |
| # | |
| # This script wraps a command in a different background and foreground | |
| # color. Depending on what the command is, it sets the color, runs the | |
| # command, then sets the color back to what it was before | |
| # | |
| # To display the current colors being used: |
This file contains hidden or 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
| { | |
| "status":"200 OK", | |
| "code":"/api/status/ok", | |
| "qname":{ | |
| "code":"/api/status/error", | |
| "messages":[ | |
| { | |
| "info":{ | |
| "count":2, | |
| "result":[ |
This file contains hidden or 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 Attachment < ActiveRecord::Base | |
| belongs_to :attachable, :polymorphic => true | |
| has_attachment :storage => :file_system, | |
| :file_system_path => "public/files/attachments", | |
| :max_size => 100.megabytes | |
| validates_as_attachment | |
| # | |
| # Override acts_as_attachment method for inherited classes. Just redefine attachment options instead. | |
| # |
This file contains hidden or 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
| require 'rubygems' | |
| require 'feedzirra' | |
| def get_feed(url) | |
| geotagged_boos = [] | |
| elements = {'georss:point' => :location, 'itunes:keywords' => :tags} | |
| elements.each do |key, value| | |
| Feedzirra::Feed.add_common_feed_entry_element(key, :as => value) | |
| end | |
| feed = Feedzirra::Feed.fetch_and_parse(url) | |
| unless feed.entries.empty? |
This file contains hidden or 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_method /as"d/ do | |
| end |
This file contains hidden or 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
| NSString *requiredIOS = @"4.0"; | |
| NSString *currentIOS = [[UIDevice currentDevice] systemVersion]; | |
| // Blocks are kinda available but broken and unsupported on 3.2 - just test the version number to see if we have block support | |
| ABBlocksSupported = (CFStringCompare((CFStringRef)currentIOS, (CFStringRef)requiredIOS, kCFCompareNumerically) != kCFCompareLessThan); |
This file contains hidden or 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
| diff --git a/lib/acts_as_taggable_on/acts_as_taggable_on/core.rb b/lib/acts_as_taggable_on/acts_as_taggable_on/core.rb | |
| index 5e9bdaa..fc51c2d 100644 | |
| --- a/lib/acts_as_taggable_on/acts_as_taggable_on/core.rb | |
| +++ b/lib/acts_as_taggable_on/acts_as_taggable_on/core.rb | |
| @@ -197,20 +197,21 @@ module ActsAsTaggableOn::Taggable | |
| else | |
| scope = scope.group("#{ActsAsTaggableOn::Tag.table_name}.#{ActsAsTaggableOn::Tag.primary_key}") | |
| end | |
| scope.all |
This file contains hidden or 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
| #!/usr/bin/env ruby | |
| require 'rubygems' | |
| require 'open-uri' | |
| require 'json' | |
| # Clone a github repo, add all forks as remotes: | |
| # $ git clone https://github.com/rails/rails.git | |
| # $ cd rails | |
| # $ git add-github-forks |
OlderNewer