Models | Examples |
---|---|
Display ads | Yahoo! |
Search ads |
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
#!/usr/bin/env ruby | |
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. | |
APP_PATH = File.expand_path('../../config/application', __FILE__) | |
require File.expand_path('../../config/boot', __FILE__) | |
# Add --editor option to open generated files in editor | |
# ----------------------------------------------------- | |
module Rails | |
module Generators |
A clean workaround for running capybara tests on Rails with assets pipeline enabled.
Original: teamcapybara/capybara#500 (comment)
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
// automatically adds JS bindings to attach Google Analytics tracking | |
// | |
// defaults | |
// | |
// class: ga-track all elements with this class will have | |
// handlers attached on DOM ready | |
// | |
// data-ga-binding: click the binding on which to fire the tracking | |
// | |
// data-ga-event: _trackEvent the analytics event send to Google |
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
# config/initializers/source_maps.rb | |
if Rails.env.development? | |
module CoffeeScript | |
class SourceMapError < StandardError; end; | |
class << self | |
def compile script, options | |
script = script.read if script.respond_to?(:read) |
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
pdftk original.pdf output uncompressed.pdf uncompress | |
LANG=C sed -n '/^\/Annots/!p' uncompressed.pdf > stripped.pdf | |
pdftk stripped.pdf output final.pdf compress |
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
--- | |
language: objective-c | |
before_script: | |
- ./scripts/travis/add-key.sh | |
after_script: | |
- ./scripts/travis/remove-key.sh | |
after_success: | |
- ./scripts/travis/testflight.sh | |
env: | |
global: |
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
# NOTE hack to get SimpleCov to load MyEngine | |
# @see http://stackoverflow.com/questions/9501607/simplecov-with-multiple-apps-or-in-short-how-does-simplecov-work | |
# @see https://twitter.com/TheDeadSerious/status/349851185819299840 | |
SimpleCov.adapters.delete(:root_filter) | |
SimpleCov.filters.clear | |
SimpleCov.adapters.define 'engine_filter' do | |
add_filter do |src| | |
!(src.filename =~ /^#{SimpleCov.root}/) unless src.filename =~ /my_engine/ | |
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
On the shared machine: | |
Download http://code.google.com/p/selenium/downloads/detail?name=selenium-server-standalone-2.33.0.jar&can=2&q= | |
$ brew install chromedriver | |
$ java -jar selenium-server-standalone-2.33.0.jar | |
On the local machine: | |
Set `CHROME_HOSTNAME` in your `.env`, `.rbenv_vars`, or per run. |
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 Rack | |
class ApiContentType | |
def initialize(app, methods = [:post, :patch], path = /^\/api\/v2+/, content_type = 'application/json') | |
@app = app | |
@methods = (methods.is_a?(Array) ? methods : [methods]).map{ |item| item.to_s.upcase } | |
@path = path | |
@content_type = content_type | |
end | |
def call(env) |