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
SELECT table_name, engine, version, table_collation AS collation, table_rows AS rows FROM information_schema.tables WHERE table_schema = DB_NAME; |
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
[[Reachability reachabilityForLocalWiFi] currentReachabilityStatus] == ReachableViaWiFi |
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
var DerivedClass = Class.create(ParentClass, { | |
initialize: function($super, param1) { | |
} | |
} |
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
module MultiparameterHack | |
def self.included klass | |
klass.class_eval do | |
@date_error_on_attribute = nil | |
def validate | |
errors.add_to_base "Invalid Date #{@date_error_on_attribute}" if @date_error_on_attribute | |
end | |
undef :execute_callstack_for_multiparameter_attributes |
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
module ErrorsHelper | |
def error_messages_for(*params) | |
options = params.extract_options!.symbolize_keys | |
if object = options.delete(:object) | |
objects = Array.wrap(object) | |
else | |
objects = params.collect {|object_name| instance_variable_get("@#{object_name}") }.compact | |
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
require 'net/http' | |
require 'uri' | |
require 'rubygems' | |
@auth = {:api_token => 'my token'} | |
Net::HTTP.start('posterous.com') {|http| | |
req = Net::HTTP::Get.new("/api/v2/users/me/sites/primary/posts?api_token=#{@auth[:api_token]}") | |
req.basic_auth 'my email address', 'my password' | |
response = http.request(req) |
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
require 'spec_helper' | |
describe NewsletterSubscriber do | |
describe "validations" do | |
before(:each) do | |
NewsletterSubscriber.create(:email => "[email protected]") | |
end | |
it { should validate_presence_of(:email) } | |
it { should validate_uniqueness_of(:email) } |
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
require 'rubygems' | |
require 'optparse' | |
require 'yaml' | |
task :np do | |
OptionParser.new.parse! | |
ARGV.shift | |
title = ARGV.join(' ') | |
path = "_posts/#{Date.today}-#{title.downcase.gsub(/[^[:alnum:]]+/, '-')}.markdown" |
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
*** [err :: xxx.xxx.xxx.xxx] Invalid gemspec in [/var/apps/myapp-staging/shared/bundle/ruby/1.8/specifications/carrierwave-0.6.0.gemspec]: Illformed requirement ["#<YAML::Syck::DefaultKey:0x11e87478> 1.1.4"] | |
*** [err :: xxx.xxx.xxx.xxx] | |
*** [err :: xxx.xxx.xxx.xxx] Invalid gemspec in [/var/apps/myapp-staging/shared/bundle/ruby/1.8/specifications/carrierwave-0.6.0.gemspec]: Illformed requirement ["#<YAML::Syck::DefaultKey:0x11e87478> 1.1.4"] | |
*** [err :: xxx.xxx.xxx.xxx] | |
*** [err :: xxx.xxx.xxx.xxx] WARNING: #<ArgumentError: Illformed requirement ["#<YAML::Syck::DefaultKey:0x11e87478> 1.1.4"]> | |
*** [err :: xxx.xxx.xxx.xxx] # -*- encoding: utf-8 -*- | |
*** [err :: xxx.xxx.xxx.xxx] | |
*** [err :: xxx.xxx.xxx.xxx] Gem::Specification.new do |s| | |
*** [err :: xxx.xxx.xxx.xxx] s.name = %q{carrierwave} | |
*** [err :: xxx.xxx.xxx.xxx] s.version = "0.6.0" |
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
# Support for Rspec / Capybara subdomain integration testing | |
# Make sure this file is required by spec_helper.rb | |
# | |
# Sample subdomain test: | |
# it "should test subdomain" do | |
# switch_to_subdomain("mysubdomain") | |
# visit root_path | |
# end | |
DEFAULT_HOST = "lvh.me" |
OlderNewer