Skip to content

Instantly share code, notes, and snippets.

View gist:fe87ac43ee52f061ef74
module DefaultOrder
module_function
def order(data)
data
end
end
module RandomOrder
module_function
def order(data)
View gist:8dd6559636ea8da5d93d
require "rails_helper"

describe "Speed Test" do
  10.times do
    it "uses fixtures" do
      users(:brad)
    end
  end
@thoughtless
thoughtless / vnc.sh
Created Feb 7, 2011
A single script for starting, connecting to, and stopping a VNC server
View vnc.sh
#!/bin/bash
# Here's how this works:
# 1) Open an SSH session
# a) Include a tunnel. Use port 5900 locally (default for VNC) and port 5901 remotely (default for tightvncserver).
# b) The SSH commands are run in the backgroud (so we can run other commands before they finish.
# c) Start tightvncserver.
# d) After starting tightvncserver, wait an extra 10 seconds before closing the SSH session (and the SSH tunnel). See below for when the SSH tunnel is actually closed. Note: you would need to increase this in order to have enough time to enter the password if you aren't using the passwd option to point to a password file.
# 2) Sleep 5 seconds. This gives enough time for the tightvncserver to start running.
# 3) Connect to VNC using the SSH tunnel and the password stored in /path/to/passwd. Once we do this, the SSH tunnel will be forced to stay open as long as our VNC session is open.
View gist:222084
Request: What Twilio sent your server HTTP Method: POST
HTTP URL: https://twilio-test-2.heroku.com/call
HTTP BODY: Key Value
AccountSid AC4c7328c003b1f8184d57aa643c358de4
CallStatus in-progress
CalledVia
Called 7782944419
CallerCountry CA
CalledZip
CallerCity WHITE ROCK
View gist:222070
def test_heroku_post
# Ignore postback for completed call
return render(:nothing => true) if params[:CallStatus] == 'completed'
method = params[:method] || 'POST' # change this to test
# Twilio posting digits
if params[:Digits]
twilio = Twilio::Verb.new do |verb|
verb.say params[:Digits]