This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Liquid::Strainer | |
def is_haml?; false; end | |
def controller | |
@controller ||= @context.registers[:controller] | |
end | |
delegate :request, :to => :controller | |
delegate :params, :to => :request | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ============================================================================================ | |
// = 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) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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") | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=== 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'unicode' | |
class String | |
def to_permalink | |
str = Unicode.normalize_KD(self).gsub(/[^\x00-\x7F]/n,'') | |
str = str.gsub(/[^-_\s\w]/, ' ').downcase.squeeze(' ').tr(' ', '-') | |
str = str.gsub(/-+/, '-').gsub(/^-+/, '').gsub(/-+$/, '') | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |