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
'.source.ruby': | |
'allow(object).to receive(:method) { return_value }': | |
'prefix': 'arr' | |
'body': 'allow(${1:object}).to receive(:${2:method}) { ${3:value} }' | |
'allow(object).to receive(:method)': | |
'prefix': 'ar' | |
'body': 'allow(${1:object}).to receive(:${2:method})' | |
'allow(object).to receive_messages(method: value)': |
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 'vendor/sinatra/lib/sinatra.rb' | |
set :public, File.expand_path(File.dirname(__FILE__) + '/public') # Include your public folder | |
set :views, File.expand_path(File.dirname(__FILE__) + '/views') # Include the views | |
set :environment, :production | |
disable :run, :reload |
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
class Domain | |
def self.matches?(request) | |
request.domain.present? && request.domain != 'example.com' | |
end | |
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
# run in non-daemonized mode (so you can monitor it) with `god -c /path/to/mysql.god -D` | |
# run normally with `god -c /path/to/mysql.god` | |
# Settings for email notifications (optional) | |
God::Contacts::Email.defaults do |d| | |
d.from_email = '[email protected]' | |
d.from_name = 'God' | |
d.delivery_method = :smtp # this can also be :sendmail | |
d.server_host = 'smtp.myapp.com' | |
d.server_port = 25 |
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
class User < ActiveRecord::Base | |
belongs_to :organization | |
has_many :projects | |
validates :name, :presence => true | |
validates :email, :uniqueness => true | |
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
{ | |
"auto_complete": false, | |
"binary_file_patterns": | |
[ | |
"*.dds", | |
"*.eot", | |
"*.gif", | |
"*.ico", | |
"*.jar", | |
"*.jpeg", |
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
guard "spork", rspec_env: { "RAILS_ENV" => "test" }, rspec_port: 8999 do | |
watch("config/application.rb") | |
watch("config/environment.rb") | |
watch("config/environments/test.rb") | |
watch(%r{^config/initializers/.+\.rb$}) | |
watch("Gemfile") | |
watch("Gemfile.lock") | |
watch("spec/spec_helper.rb") { :rspec } | |
watch(%r{^spec/factories/.+\.rb$}) | |
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
if application "Rdio" is running then | |
tell application "Rdio" to playpause | |
else if application "iTunes" is running then | |
tell application "iTunes" to playpause | |
end if | |
if application "Rdio" is running then | |
tell application "Rdio" to next track | |
else if application "iTunes" is running then | |
tell application "iTunes" to next track |
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
# handle api errors | |
$.ajaxSetup | |
statusCode: | |
401: -> | |
# authentication error | |
404: -> | |
# not found | |
500: -> | |
# application error |
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
ActiveAdmin.register User do | |
# ...truncated code... | |
controller do | |
def create | |
super do |format| | |
redirect_to collection_url and return if resource.valid? | |
end | |
end |
NewerOlder