Install nginx:
$ brew install nginx
Use custom launchctl
plist (see homebrew.mxcl.nginx.plist below):
require "benchmark" | |
Benchmark.bm(7) do |bench| | |
bench.report("single") do | |
1_000_000.times do | |
'This is a string of substantial length. I doubt you will have many string | |
literals in your code that are longer than this, but if there are actually | |
costs to parsing double quoted strings this should exacerbate that.' | |
end | |
end |
module Admin::TicketsHelper | |
def admin_tickets_table(tickets) | |
Tabular.build(tickets) do |table| | |
# If we're simply adding a few columns where the header would be the | |
# humanized attribute name and the row would contain the attribute `.to_s` | |
# then we can use the simple `#columns` method. | |
table.columns :id, :title | |
# If the column has custom logic for row values, we can use the `#column` | |
# method to define it |
class MyModel < ActiveRecord::Base | |
private | |
# Allow mass-assignment of the type attribute | |
def self.attributes_protected_by_default | |
super - %W[ type ] | |
end | |
end |
# Enables {command,ctrl}+enter on all textareas | |
# Author: Nick Giancola (@patbenatar) | |
$ -> | |
$("textarea").keydown (e) -> | |
if (e.ctrlKey or e.metaKey) and e.keyCode is 13 | |
$("textarea").closest("form").submit() |
#!/bin/sh | |
# Stolen from Joshua Clayton of thoughtbot: | |
# http://robots.thoughtbot.com/post/19398560514/how-to-copy-and-paste-with-tmux-on-mac-os-x | |
PATH=/usr/local/bin:$PATH | |
while true; do | |
if test -n "`tmux showb 2> /dev/null`"; then | |
tmux saveb - | pbcopy && tmux deleteb |
Backbone.View.register = (role) -> | |
$ => new @(el: element).render() for element in $("@" + role) |
# Provides a helper method for controllers who need to query a nested resource. | |
# Implements per-request in-memory caching for nested resources as well as | |
# support for controllers that are also accessed without being nested. | |
module NestedResource | |
DEFAULT_OPTIONS = { | |
optional: false, | |
class_name: nil, | |
param: nil | |
} |
The following document outlines a basic design for implementing single sign-on in a service-oriented architecture with many user-facing apps. I have posted it here hoping to get feedback, so don't be afraid to fork and/or comment with your thoughts.
The design relies on two main components in addition to the user-facing servers (apps) and app-facing servers (services):