Here's what I did to get things working.
Yep, over at: https://developer.apple.com
if [ -f "${rvm_path}/scripts/rvm" ]; then | |
source "${rvm_path}/scripts/rvm" | |
if [ -f ".rvmrc" ]; then | |
source ".rvmrc" | |
elif [ -f ".ruby-version" ] && [ -f ".ruby-gemset" ]; then | |
rvm use `cat .ruby-version`@`cat .ruby-gemset` | |
elif [ -f ".ruby-version" ]; then | |
rvm use `cat .ruby-version` |
# to generate your dhparam.pem file, run in the terminal | |
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |
## Docker | |
Docker is a platform to build, ship and run distributed applications. The platform is made up of two components: | |
1. Docker server | |
This runs as a daemon and manages all the containers. | |
2. Docker client |
Here's what I did to get things working.
Yep, over at: https://developer.apple.com
// http://www.nczonline.net/blog/2009/06/23/loading-javascript-without-blocking/ | |
function loadScript(url, callback){ | |
var script = document.createElement("script") | |
script.type = "text/javascript"; | |
if (script.readyState){ //IE | |
script.onreadystatechange = function(){ | |
if (script.readyState == "loaded" || |
define(function(){ | |
var instance = null; | |
function MySingleton(){ | |
if(instance !== null){ | |
throw new Error("Cannot instantiate more than one MySingleton, use MySingleton.getInstance()"); | |
} | |
this.initialize(); | |
} |
#!/usr/bin/env ruby | |
puts "Run this in another terminal:" | |
puts "" | |
puts " sudo ./trace-gc-standalone.sh #{$$}" | |
puts "" | |
puts "... wait for the 'Ready!' message, switch back here and press enter to start." | |
GC::Profiler.enable | |
$stdin.gets |
# See: | |
# * http://thepugautomatic.com/2014/03/simpledelegator-autoloading-issues-with-rails/ | |
# * https://groups.google.com/forum/#!topic/rubyonrails-core/PjGUK72BmFA | |
# * https://gist.github.com/henrik/9314943 | |
require "delegate" | |
class RailsCompatibleSimpleDelegator < SimpleDelegator | |
def self.const_missing(name) | |
if ::Object.const_defined?(name) |
## stub v should_receive | |
## This is just a simple example to show uses of stub, and should_receive. Imagine you have the following code: | |
# topic.rb | |
class Topic < ActiveRecord::Base | |
has_many :stories | |
def add_story(story) | |
unless exists? story |