Skip to content

Instantly share code, notes, and snippets.

View jdelStrother's full-sized avatar
👋

Jonathan del Strother jdelStrother

👋
View GitHub Profile
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
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:
#!/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:
{
"status":"200 OK",
"code":"/api/status/ok",
"qname":{
"code":"/api/status/error",
"messages":[
{
"info":{
"count":2,
"result":[
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.
#
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?
my_method /as"d/ do
end
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);
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
#!/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