Class names are CamelCase
.
Methods and variables are snake_case
.
Methods with a ?
suffix will return a boolean.
<!DOCTYPE html> | |
<script src="url.js"></script> | |
<script> | |
var url = new URL('http://www.example.com/a/b/c.html?p=q&r=s&p&p=t#hash'); | |
for (var key in url) { | |
console.log(key, url[key]); | |
} |
class ApplicationController < ActionController::Base | |
... | |
#Problem: | |
#In rails 3.0.1+ it is no longer possible to do this anymore; | |
# rescue_from ActionController::RoutingError, :with => :render_not_found | |
# | |
#The ActionController::RoutingError thrown is not caught by rescue_from. | |
#The alternative is to to set a catch-all route to catch all unmatched routes and send them to a method which renders an error | |
#As in http://techoctave.com/c7/posts/36-rails-3-0-rescue-from-routing-error-solution |
# Copy this into your `~/.profile`. | |
# This setup an incredibly ugly hack that recompiles your `PATH` | |
# everytime the prompt is printed. | |
# I need this to inject the nearest `node_modules/.bin` into my | |
# path to make it easy to use the binarys there. | |
# Your normal PATH exports here | |
export PATH=$HOME/bin:$PATH | |
ORIGINAL_PATH=$PATH |
record = Post.new(:title => 'Yay', :body => 'This is some insert SQL') | |
# easiest way to achieve this is by calling protected #arel_attributes_values (tested in | |
# rails 3.2.13). the alternative is to build the entire insert statement using arel >_> | |
record.class.arel_table.create_insert \ | |
.tap { |im| im.insert(record.send(:arel_attributes_values, false)) } \ | |
.to_sql |
# SSL self signed localhost for rails start to finish, no red warnings. | |
# 1) Create your private key (any password will do, we remove it below) | |
$ openssl genrsa -des3 -out server.orig.key 2048 | |
# 2) Remove the password | |
$ openssl rsa -in server.orig.key -out server.key |
# Requires the presence of a failover node that will get activated when the site is in maintenance mode, and will be disabled when the site is live. | |
namespace :deploy do | |
namespace :web do | |
desc <<-DESC | |
Disable via Cloud Load Balancers | |
DESC | |
task :lbdisable do |