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
# Initializer: | |
# require 'mail_delivery_catchall.rb' if Rails.env.staging? | |
# Rails 3 | |
module ActionMailer | |
class Base | |
class << self | |
def deliver_mail_with_catchall(mail, &block) |
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 WillPaginateJqueryMobileRenderer < WillPaginate::ViewHelpers::LinkRenderer | |
def container_attributes | |
super.merge({ | |
:'data-role' => 'navbar' | |
}) | |
end | |
def pagination | |
@options[:page_links] ? windowed_page_numbers : [] |
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
# Close unclosed tags | |
def fix_invalid_html(html) | |
Nokogiri::HTML::DocumentFragment.parse(html).to_html | |
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
module Globalize | |
module ActiveRecord | |
class Adapter | |
def write_with_hash(locale, name, value) | |
if value.is_a?(Hash) | |
value.each do |locale, value| | |
self.write_without_hash(locale, name, value) | |
end | |
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
class Item < ActiveRecord::Base | |
named_scope :ascend_by_optional_category_title, | |
:joins => "LEFT JOIN categories AS optional_categories ON optional_categories.id=items.category_id", | |
:order => "optional_categories.title" | |
named_scope :descend_by_optional_category_title, | |
:joins => "LEFT JOIN categories AS optional_categories ON optional_categories.id=items.category_id", | |
:order => "optional_categories.title DESC" |
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
# Add option to deliver all mails to one address. Useful in staging environment. | |
# config.action_mailer.delivery_method = :catchall | |
module ActionMailer | |
class Base | |
def perform_delivery_catchall(mail) | |
original_to = mail.to | |
mail.to = "youremail@yourdomain" | |
mail.cc = "" |
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
# Based on | |
# https://github.com/ng/paperclip-watermarking-app/blob/master/lib/paperclip_processors/watermark.rb | |
# Modified by Laurynas Butkus | |
module Paperclip | |
class Watermark < Processor | |
# Handles watermarking of images that are uploaded. | |
attr_accessor :format, :whiny, :watermark_path, :position | |
def initialize file, options = {}, attachment = nil |
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
module FormBuilderHelper | |
def multi_locale_field(method, opts = {}) | |
opts = { | |
:type => :text_field | |
}.merge(opts) | |
type = opts.delete(:type) | |
html = [] | |
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
#!/bin/sh | |
# | |
# Update GeoLite Cities database from MaxMind | |
# (C) 2010 Laurynas Butkus laurynas.butkus at gmail.com | |
# | |
TMP=/tmp | |
TARGET_DIR=/usr/local/share/GeoIP | |
cd $TMP |
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
Usualy we hang out in Kreuzberg, Friedrichshein and Prenzlauerberg areas as well as Mitte (center). | |
http://berlin.unlike.net/locations/39-Club-der-Visionaere | |
Club der Visionaere - an outside bar/club/place to hang out in Kreuzberg. It's IN one of the canals, on some sort of floating rafts. | |
Schlesische str., leading to the club is also worth noticing with one of the best indian food restaurants and lots of small watering holes. L.U.X .with live bands and Vendel with experimental poetry in german are my favourites:) | |
Bar 25 - another outside bar on the bank of river. 3 day parties or just to sit back and spend a warm afternoon. Also has circus, motel and restaurant. | |
http://berlin.unlike.net/locations/272-Bar-25 | |
Hops & Barley brewery pub (Friedrichshain) - locally brewed beer in one of my favourite neighbourhoods. The whole area between Boxhander str and Simon Dach str. is dense with pubs, thai food restaurants and Kieze-kiosks (small shops with astounishing variety of beers). |