Triple backticks are used to open and close code blocks. The triple backticks need to be on their own line:
puts "hello world"
And here is another, separate code block. Triple backticks open and close it:
puts "line 1"
#! /bin/bash | |
# restart will start thin without error even when it is not already running. | |
echo "Usage: ./script/thin start|stop|restart" | |
# Log and pid file names will include port number before the .log/.pid extension. | |
bundle exec thin --pid tmp/pids/thin.pid --servers 1 --daemonize --log log/thin.log --port 3000 $1 | |
bundle exec thin --pid tmp/pids/thin.pid --servers 1 --daemonize --log log/thin.log --port 3001 --ssl $1 |
# Put this in your local ~/.ssh/config to be prompted for password only once for multiple terminals | |
ControlMaster auto | |
ControlPath /tmp/ssh_mux_%h_%p_%r |
// Perform HTTP POST to the given URL using selenium. Put this in actions.js. | |
// Works with selenese: | post | http://url-to-http-post-to.com/ | | |
Selenium.prototype.doPost = function(url) { | |
var form = this.getCurrentWindow().document.createElement('form'); | |
form.id = 'formAddedBySeleniumDoPost'; | |
form.method = 'POST'; | |
form.action = url; | |
var body = this.browserbot.findElement("css=body"); | |
if (typeof body == "undefined") { | |
throw new SeleniumError("No body element to append form element to for performing POST to url '" + url + "'"); |
Triple backticks are used to open and close code blocks. The triple backticks need to be on their own line:
puts "hello world"
And here is another, separate code block. Triple backticks open and close it:
puts "line 1"
class Api::ApiController < ActionController::Base | |
protect_from_forgery with: :null_session | |
def self.disable_turbolinks_cookies | |
skip_before_action :set_request_method_cookie | |
end | |
disable_turbolinks_cookies | |
end |
+++ b/app/scopes/base_scopes.rb | |
+class BaseScopes < SimpleDelegator | |
+ | |
+ def initialize | |
+ super self.class.relation | |
+ end | |
+ | |
+ def self.method_missing(method_name, *args) | |
+ method = self.new.method(method_name) | |
+ method.to_proc |
<%# Shows a map centred on London, using the default marker/pin image. %> | |
<%= gmaps4rails([{:lat => 51.51, :lng => -0.12}].to_json) %> | |
<%= yield :scripts %><%# Usually yield :scripts goes just before the closing body tag %> |
# 1. Add rack-rewrite to your Gemfile and run 'bundle install': | |
# gem 'rack-rewrite' | |
# | |
# 2. Create a file with the contents below in config/initializers/asset_server_middleware.rb | |
# | |
# 3. Rename 'YourApp' below | |
# | |
# 4. In config/environments/production.rb and config/environments/test.rb, set: | |
# config.serve_static_assets = true | |
# config.assets.compile = false |
# app/models/audit.rb | |
Audit = Audited.audit_class | |
class Audit | |
scope :foo, -> { where("created_at > 0") } | |
scope :bar, -> { where("updated_at > 0") } | |
end | |
# Using scopes example: | |
# Audit.foo.bar |
#!/bin/sh | |
# Create this file in the bin/ directory of your | |
# Rails app. | |
# Run this script to deploy the app to Heroku. | |
set -e | |
# Push changes to Heroku |