View nil_or.rb
This file contains 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
# Creates an object you can savely traverse without getting nil. | |
# This is very pleasant for deep data-structures. | |
# You can punch the duck until it should become a string: | |
# NilOr.new(nil).what.the.fuck?.to_s --> nil | |
class NilOr | |
def initialize(object, parent = nil) | |
@object = object | |
@call_stack = (parent || []) | |
puts "current stack #{@call_stack}" |
View i_dont_give_a_shit.rb
This file contains 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
alias :method_missing_i_dont_give_a_shit :method_missing | |
def method_missing(sym,*args, &block) | |
puts "sym is #{sym}" | |
method_name = sym.to_s | |
if /.+\?$/ =~ method_name | |
puts "i dont care" | |
target_method = method_name[0..-2] | |
puts "target is #{target_method}" | |
puts self.class |
View bindings.xml
This file contains 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
<jaxws:bindings version="2.1" wsdlLocation="service.wsdl" | |
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" | |
xmlns="http://java.sun.com/xml/ns/jaxws" xmlns:jaxws="http://java.sun.com/xml/ns/jaxws" | |
xmlns:jxb="http://java.sun.com/xml/ns/jaxb"> | |
<enableWrapperStyle>false</enableWrapperStyle> | |
<jaxws:bindings | |
node="wsdl:definitions/wsdl:types/xsd:schema[@targetNamespace='http://authentication.integration.crowd.atlassian.com']"> | |
<jxb:globalBindings generateElementProperty="false"> |
View analytics.sh
This file contains 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
#! /usr/bin/env ruby | |
[25021834, 18768647].each do |product_id| | |
url = "https://www.google.com/analytics/reporting/?reset=1&id=#{product_id}&pdr=#{(Time.now - (7 * 60 * 60 * 24)).strftime("%Y%m%d")}-#{Time.now.strftime("%Y%m%d")}" | |
`open "#{url}"` | |
end |
View git_and_brew.sh
This file contains 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
# thx to tobstarr | |
sudo mkdir -p /usr/local && sudo chown -R $USER /usr/local && curl -Lsf http://bit.ly/9H4NXH | tar xvz -C/usr/local --strip 1 && brew install git |
View talk.sh
This file contains 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
#! /usr/bin/env ruby | |
users = { | |
:rubiii => 'daniel.harrington', | |
:tri => 'thilko.richter', | |
} | |
user = users[ARGV.shift.to_sym] | |
message = ARGV.join(' ') |
View rails_admin_without_devise.rb
This file contains 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
# add RailsAdmin to the Gemfile | |
# do NOT add devise | |
gem "rails_admin", :git => "git://github.com/sferik/rails_admin.git" | |
# run Bundler | |
bundle | |
# run the generator for RailsAdmin | |
# looks like it's broken, but it just does not install devise | |
# you may also remove the app/config/locales/devise.en.yml |
View Gemfile.rb
This file contains 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
source :gemcutter | |
gem "rails", "~> 3.0.3" | |
gem "rails_redis_cache", "~> 0.0.4" | |
gem "haml", "~> 3.0.25" | |
gem "hashie", "~> 1.0.0" | |
gem "asin", "~> 0.2.0" # hashie 1.0.0 | |
gem "twitter", "~> 1.1.1" # hashie 0.4.0 | |
gem "coderay", "~> 0.9.3" |
View action_view_base.rb
This file contains 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
if development? | |
module ActionView | |
class Base | |
alias_method :rails_render, :render | |
# add debugging comments for partials to the rendered html | |
def render(options = {}, local_assigns = {}, &block) | |
output = rails_render(options, local_assigns, &block) | |
if options.respond_to?(:keys) && options[:partial] && (response.content_type.nil? || response.content_type =~ /html/) |
View dsl.rb
This file contains 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
# encoding utf-8 | |
module DSL | |
link_to "Articles", { :controller => "articles" }, :id => "news", :class => "article" | |
def doit_with(some, parameters) | |
# does it | |
end | |
def doit_with(mandatory, optional=nil, parameters=nil) |
OlderNewer