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
AWS::S3::Base.class_eval do | |
class << self | |
def request_with_rewind(verb, path, options = {}, body = nil, attempts = 0, &block) | |
body.rewind if body.respond_to?(:rewind) | |
request_without_rewind verb, path, options, body, attempts, &block | |
end | |
alias_method_chain :request, :rewind | |
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
class ReadonlyFormBuilder < ActionView::Helpers::FormBuilder | |
def calendar_date_select(method, options = {}) | |
text_field method, options | |
end | |
def check_box(method, options = {}, checked_value = "1", unchecked_value = "0") | |
merge_class_options 'readonly furtive', options | |
options.update :readonly => true | |
super | |
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
Webrat::SaveAndOpenPage.module_eval do | |
def rewrite_css_and_image_references(response_html) | |
response_html.gsub(/("|')\/(stylesheets|images|javascripts)/) {"#{$1}../public/#{$2}"} | |
end | |
def saved_page_dir | |
File.expand_path('./tmp') | |
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
require 'rack/utils' | |
class UnknownHttpMethodMiddleware | |
def initialize(app) | |
@app = app | |
end | |
def call(env) | |
return [401, {}, ''] if %w(connect).include?(env["REQUEST_METHOD"].downcase) | |
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
begin | |
require 'jasmine' | |
load 'jasmine/tasks/jasmine.rake' | |
namespace :jasmine do | |
task :server_without_open => :server | |
desc 'Run specs via server' | |
task :server_with_open do | |
Rake::Task['jasmine:server_without_open'].invoke |
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
#import <UIKit/UIKit.h> | |
@protocol SwipeViewDelegate; | |
@interface SwipeView : UIView { | |
id <SwipeViewDelegate> swipeDelegate; | |
int touchBeganX, touchBeganY; | |
int touchMovedX, touchMovedY; | |
} |
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
# This goes in spec/javascripts/support/jasmine_config.rb | |
Jasmine::Config.class_eval do | |
def src_files_with_remote_files | |
remote_files = simple_config['src_files'].select {|f| f =~ /^http:\/\//} | |
remote_files + src_files_without_remote_files | |
end | |
alias_method :src_files_without_remote_files, :src_files | |
alias_method :src_files, :src_files_with_remote_files | |
def js_files_with_remote_files(*args) |
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
module MyCustomFilters | |
def full_urls(input) | |
input.gsub /(<\s*(a|img|video|audio)\s+[^>]*(href|src)\s*=\s*[\"'])(?!http:\/\/|https:\/\/|sftp:\/\/)([^\"'>]+)[\"'>]/ do | |
"#{$1}http://example.com#{$2}" | |
end | |
end | |
end | |
Liquid::Template.register_filter MyCustomFilters |
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
#import <SenTestingKit/SenTestingKit.h> | |
#import <CoreData/CoreData.h> | |
@interface Test : SenTestCase { | |
NSManagedObjectModel *model; | |
NSPersistentStoreCoordinator *coordinator; | |
NSManagedObjectContext *context; | |
} | |
- (NSString *)applicationSupportDirectory; |
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
Dir[ARGV.join(" ") + '/*.AVI'].each do |movie| | |
command = %{ | |
tell application "ffmpegX" | |
activate | |
set contents of the fifth text field of front window to "#{movie}" | |
set contents of the second text field of front window to "#{movie.sub('AVI.ff.mov', 'mov').sub('AVI', 'mov')}" | |
tell application "System Events" | |
tell process "ffmpegX" to keystroke "\r" | |
end tell | |
end tell |