Skip to content

Instantly share code, notes, and snippets.

View RichardJordan's full-sized avatar

Richard Jordan RichardJordan

  • Los Angeles, CA
View GitHub Profile
#!/usr/bin/env rake
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec => :dummy_app) do |t|
t.pattern = File.expand_path('../spec/**/*_spec.rb', __FILE__)
end
task :default => :spec
desc 'Generates a dummy app for testing'
task :dummy_app => [:setup, :migrate]
# RSpec matcher to spec delegations.
#
# Usage:
#
# describe Post do
# it { should delegate(:name).to(:author).with_prefix } # post.author_name
# it { should delegate(:month).to(:created_at) }
# it { should delegate(:year).to(:created_at) }
# end
require 'net/ftp'
CONTENT_SERVER_DOMAIN_NAME = "one-of-the-ftp-server.thought-sauce.com.hk"
CONTENT_SERVER_FTP_LOGIN = "saucy-ftp-server-login"
CONTENT_SERVER_FTP_PASSWORD = "saucy-ftp-server-password"
# LOGIN and LIST available files at default home directory
Net::FTP.open(CONTENT_SERVER_DOMAIN_NAME, CONTENT_SERVER_FTP_LOGIN, CONTENT_SERVER_FTP_PASSWORD) do |ftp|
files = ftp.list
require "spec_helper"
describe ExampleController do
context "GET #index" do
let(:resources) { FactoryGirl.create_list(:resource) }
before do
get :index
end

Build your own private, encrypted, open-source Dropbox-esque sync folder

Prerequisites:

  • One or more clients running a UNIX-like OS. Examples are given for Ubuntu 12.04 LTS, although all software components are available for other platforms as well (e.g. OS X). YMMV
  • A cheap Ubuntu 12.04 VPS with storage. I recommend Backupsy, they offer 250GB storage for $5/month. Ask Google for coupon codes.

Software components used:

  • Unison for file synchronization
  • EncFS for folder encryption
@RichardJordan
RichardJordan / gist:2048567
Created March 16, 2012 04:59
browserid auth with rails
def signIn #with browserid
ans = 'invalid'
if (params['BIDASSERT'] != nil)
assertion = params['BIDASSERT']
audience = request.host_with_port
http = Net::HTTP.new('browserid.org', 443)
http.use_ssl = true
headers = {
'Content-Type' => 'application/x-www-form-urlencoded',
}