Skip to content

Instantly share code, notes, and snippets.

View JonCrawford's full-sized avatar
🏗️
Helping startups on product, tech & UX

Jonathan Crawford JonCrawford

🏗️
Helping startups on product, tech & UX
View GitHub Profile
class Liquid::Strainer
def is_haml?; false; end
def controller
@controller ||= @context.registers[:controller]
end
delegate :request, :to => :controller
delegate :params, :to => :request
end
// ============================================================================================
// = Cachable Time Ago In Words - http://nullstyle.com/wp-content/uploads/2007/11/jsdates.txt =
// ============================================================================================
var DateHelper = {
timeAgoInWords: function(from) {
return this.distanceOfTimeInWords(new Date().getTime(), from);
},
distanceOfTimeInWords: function(to, from) {
def index
@assets = current_account.assets.paginate :page => params[:page], :per_page => 10
end
# How to spec this???
before(:each) do
@account = Account.new
@assets = [Asset.new(:account => @account)]
end
it "should paginate the assets"
require 'models/developer'
require 'models/project'
class JoinTableTimestampTest < ActiveRecord::TestCase
def test_should_create_fresh_timestamp_on_join_table
developer = Developer.create(:salary => 50000, :name => "Foobar Bacon")
project = Project.create
sleep 3
# Bash snippet to open new shells in most recently visited dir.
# Useful if you want to open a new terminal tab at the present
# tab's location.
#
# Put this in your .bashrc or whatever.
pathed_cd () {
if [ "$1" == "" ]; then
cd
else
<?php
//exploit search
$Lversion = php_uname(r);
$OSV = php_uname(s);
if(eregi('Linux',$OSV))
{
$Lversion=substr($Lversion,0,6);
$millink="http://milw0rm.com/search.php?dong=Linux Kernel ".$Lversion;
$stormlink="http://www2.packetstormsecurity.org/cgi-bin/search/search.cgi?searchvalue=Linux+Kernel+".$Lversion;
# needed to get spork/rspec running under snow leopard
# edit line 12 of rspec-1.2.8/lib/spec/runner/drb_command_line.rb
# was
# DRb.start_service("druby://localhost:0")
# should be
DRb.start_service("druby://127.0.0.1:0")
=== Epic Snow Leopard Upgrayyyyd Guide ===
Son, you’re now living in the land of 64-bit systems.
That means that some of your 32-bit shit is now broken.
Not all is lost.
== Fixing MySQL weirdness
s3_config = YAML.load_file(RAILS_ROOT + "/config/amazon_s3.yml")
s3_config = s3_config['staging'].to_options
@s3 = RightAws::S3.new(s3_config[:access_key_id], s3_config[:secret_access_key])
@s3_interface = RightAws::S3Interface.new(s3_config[:access_key_id], s3_config[:secret_access_key])
to_bucket = @s3.bucket(<bucket_name>)
to_bucket = @s3.bucket(<bucket_name>)
keys = from_bucket.keys('prefix' => 'background_images')