Skip to content

Instantly share code, notes, and snippets.

Damian Janowski djanowski

Block or report user

Report or block djanowski

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:12305
class Ancestor
attr_accessor :id
def initialize(id)
@id = id
end
def ==(other)
id == other.id
end
View gist:18662
module ActiveRecord
class Base
alias_method :original_to_json, :to_json
end
end
require "json/add/rails"
module ActiveRecord
class Base
View gist:21404
def image_tag(source, options = {})
if options.is_a?(Hash) && source !~ /^http/
size = `identify public/images/#{source}`[/ (\d+x\d+) /, 1]
if options[:size]
if options[:size] != size
line = "*** WRONG SIZE SPECIFIED FOR #{source}: :size => #{size.inspect} ***"
end
else
View gist:39420
get '/posts/:id' do
# Render with or without a layout depending
# on request#xhr?. Useful for rendering regular
# requests and also partial updates like:
# $("#post").load('/posts/1')
haml :'posts/show', :layout => !request.xhr?
end
@djanowski
djanowski / gist:44344
Created Jan 7, 2009
Testing Facebook interaction with Facebooker
View gist:44344
# DISCLAIMER: this is just a hack, not even tested.
# I use this for testing interaction with Facebook.
# Basically there are a bunch of fixture XMLs that
# represent the response from Facebook.
# Oh, make sure you do this somewhere, probably in
# a setup/before block:
#
# Facebooker::Session.current = Facebooker::MockSession.create
#
# (You might need to stub session[:facebook_session] too.)
View gist:44688
# class TagsHelperTest < Test::Unit::TestCase
# helper 'app/helpers/tags'
#
# def test_tag
# assert_equal "<div></div>", helper.tag(:div)
# end
# end
require 'haml/engine'
View gist:47947
#!/usr/local/bin/ruby
# Usage:
#
# $ build.rb http://yoururl.com/your_project/push
#
# $ echo "HEAD -1 refs/heads/master" | build.rb http://yoururl.com/your_project/push
#
# or you can hard-code the URL in the following line instead
# of passing it as an argument.
View gist:75995
require 'rubygems'
dependencies = <<-EOS
rack 0.9.1
activesupport >= 2.2.2
daemons >= 1.0.10
djanowski-workling
djanowski-collage >= 0.1.3
faker >= 0.3.1
fiveruns-memcache-client >= 1.5.0
View test.rb
require "test/unit"
class FooTest < Test::Unit::TestCase
def setup
@value = true
end
def test_truth
assert @value
end
You can’t perform that action at this time.