Skip to content

Instantly share code, notes, and snippets.

@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@nofxx
nofxx / rspec_spec.rb
Created October 15, 2011 08:17
Spork on Rails 3/ActiveRecord/Fabrication
require 'spork'
Spork.prefork do
ENV['RAILS_ENV'] ||= 'test'
require 'rails/application'
Spork.trap_method(Rails::Application::RoutesReloader, :reload!)
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'database_cleaner'