Skip to content

Instantly share code, notes, and snippets.

View jdelStrother's full-sized avatar
👋

Jonathan del Strother jdelStrother

👋
View GitHub Profile
server = Thread.new do
rack = Rack::Server.new(:Port=>8000)
# rack 1.2 ignores the :app option, force it manually:
rack.instance_variable_set('@app', Rack::Directory.new(Rails.root.join('test/javascript')))
rack.start
end
sleep(0.5)
Launchy.open("http://localhost:8000/index.html")
server.join
@jdelStrother
jdelStrother / env.rb
Created August 17, 2011 17:48
Insert cucumber step names into rails' test.log
class RailsLogInterpolator
def before_step(step)
@current_step = step
Rails.logger.info("{{{ #{step.name}")
end
def before_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background)
Rails.logger.info(" #{@current_step.name} }}}\n")
end
end
<object data="http://boos.audioboo.fm/swf/playlist_player.swf" height="350" type="application/x-shockwave-flash" width="300">
<param name="movie" value="http://boos.audioboo.fm/swf/playlist_player.swf">
<param name="scale" value="noscale"><param name="salign" value="TL">
<param name="align" value="left"><param name="allowScriptAccess" value="always">
<param name="wmode" value="transparent"><param name="quality" value="best">
<param name="FlashVars" value="rssURL=http://audioboo.fm/tag/londonriots.atom">
<param name="loop" value="false"><param name="allowFullScreen" value="false">
<a href="http://audioboo.fm/tag/londonriots">Listen on audioboo.fm!</a>
</object>
require 'selenium-webdriver'
require 'rack'
require 'rack/handler/thin'
class IframeServer
def start
@pid = fork { Rack::Handler::Thin.run(self, :Port => 9292) }
poller = Selenium::WebDriver::SocketPoller.new("localhost", 9292, 30)
raise "could not start #{self.inspect}" unless poller.connected?
require 'capybara'
require 'rack'
class IframeServer
def call(env)
r = Rack::Request.new(env)
content = case r.path
when '/container.html'
pages[0]
when '/iframe1.html'
@jdelStrother
jdelStrother / git-autofix
Created June 23, 2011 13:42
Auto-fixup a previous git commit with the changes from your staging area
#!/bin/sh
# Auto-applies changes from the index to a previous commit
# eg
# git add foo
# git autofix HEAD~3
#!/bin/sh
target="$(git rev-parse $1)"
$ git clone https://github.com/keithclark/selectivizr.git
Cloning into selectivizr...
remote: Counting objects: 131, done.
remote: Compressing objects: 100% (112/112), done.
remote: Total 131 (delta 48), reused 0 (delta 0)
Receiving objects: 100% (131/131), 28.41 KiB, done.
Resolving deltas: 100% (48/48), done.
$ cd selectivizr/
$ git config --global core.autocrlf true
$ git rm --cached -r .
#!/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
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
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);