I hereby claim:
- I am ledermann on github.
- I am ledermann (https://keybase.io/ledermann) on keybase.
- I have a public key whose fingerprint is 1E2D 039D E90B 5F31 0C12 8B69 0B6D 83FB DDCE FBF3
To claim this, I am signing this object:
# Using Ruby 1.9.3 on OS X, installed via rbenv | |
~ $ irb | |
irb(main):001:0> require "bigdecimal" | |
true | |
irb(main):002:0> BigDecimal("0.2") / BigDecimal("0.5") | |
0.4 |
require 'ya2yaml' # Better than to_yaml, because it saves as UTF-8 and sorts hash by keys | |
namespace :locales do | |
desc "Parses ActiveRecord models and updates locale files" | |
task :update => :environment do | |
Dir.glob(File.join(RAILS_ROOT, 'config', 'locales', '*.yml') ).each do |locale_file| | |
# Read single locale file | |
locale_hash = YAML.load(File.read(locale_file)) | |
language = locale_hash.keys.first | |
# Rails-FormBuilder for creating forms with <label>-Tags | |
class LabeledFormBuilder < ActionView::Helpers::FormBuilder | |
helpers = field_helpers + | |
%w{date_select datetime_select time_select} + | |
%w{collection_select select country_select time_zone_select} - | |
%w{radio_button hidden_field label fields_for} # Don't decorate these | |
helpers.each do |name| | |
define_method(name) do |field, *args| |
# Building authenticated and expiring URL for S3 | |
# Based on | |
# http://github.com/logandk/paperclip_hacks/blob/master/lib/paperclip.rb | |
# and | |
# http://thewebfellas.com/blog/2009/8/29/protecting-your-paperclip-downloads | |
module Paperclip | |
class Attachment | |
def authenticated_url(style = nil, expires_in = 5.minutes) | |
if @storage.to_s == 's3' && file? | |
AWS::S3::S3Object.url_for(path(style || default_style), bucket_name, :expires_in => expires_in, :use_ssl => s3_protocol == 'https') |
# Liquid methods reflection for ActiveRecord | |
# Wanna know the defined liquid_methods for a given model? | |
# | |
# Example usage: | |
# | |
# class Person < ActiveRecord::Base | |
# liquid_methods :first_name, :last_name | |
# end | |
# | |
# Person.find(123).reflect_on_liquid_methods |
# Import a posterous.com Blog into nanoc (http://nanoc.stoneship.org) | |
# Uses Nokogiri to parse the XML data from the posterous API | |
require 'rubygems' | |
require 'nanoc3' | |
require 'nokogiri' | |
require 'open-uri' | |
module Nanoc3::Extra | |
module Importers |
# Monkey patch for the Rails plugin "acts_as_taggable_on" to handle dirty tracking | |
# http://github.com/mbleigh/acts-as-taggable-on/issues#issue/1 | |
module ActsAsTaggableOn::Taggable | |
module Core | |
module InstanceMethods | |
def set_tag_list_on_with_dirty_tracking(context,new_list) | |
value = new_list.to_s | |
attr = "#{context.to_s.singularize}_list" | |
source :gemcutter | |
gem 'rails', '~> 2.3.11' | |
gem 'i18n' | |
gem 'mysql' | |
gem 'authlogic' | |
gem 'declarative_authorization' | |
gem 'configatron' | |
gem 'mime-types', :require => 'mime/types' | |
gem 'ya2yaml' |
# Add this | |
public/javascripts/all.js |
I hereby claim:
To claim this, I am signing this object: