Skip to content

Instantly share code, notes, and snippets.

View langalex's full-sized avatar

Alexander Lang langalex

View GitHub Profile
@langalex
langalex / dont_escape_html_in_plain_text_templates.rb
Created February 27, 2012 11:00
Fixes Rails issue 687 (ActionMailer is html escaping ampersand in urls in plain text messages) for Rails 3.2.1
# fixes https://github.com/rails/rails/issues/687 for Rails 3.2.1.
# put this in an initializer.
module ActionView
class Template
module Handlers
class ERB
def call(template)
if template.source.encoding_aware?
# First, convert to BINARY, so in case the encoding is
# wrong, we can still find an encoding tag
@langalex
langalex / cobot
Created March 23, 2011 09:32
cobot demozugang
Cobot ist ein Service (Software as a Service) mit dem sogenannte Coworking Spaces (Vermietung von Arbeitsplätzen) ihre Kunden verwalten können. Dies umfasst vor allem die Verwaltung von Kundendaten und Zahlungsvorgängen, aber auch Buchung von z.B. Konferenzräumen.
Das Geschäftsmodell von cobot basiert darauf, dass Coworking Spaces (nach einer 30tägigen Testphase) für die Nutzung von Cobot eine monatliche Gebühr bezahlen. Diese ist abhängig von der Anzahl der Kunden (Coworker).
Unter http://demo.cobot.me finden Sie einen Testzugang. Oben rechts können Sie sich mit folgenden Zugangsdaten einloggen:
login: cc_demo
passwort: demo
Der Zugang ist so konfiguriert, wie ihn ein Kunde sehen würde, dessen Testzugang abgelaufen ist. Die Seite, die sie sehen, ist das, was ihrem "Bestellformular" entspricht. Sobald Kreditkartenzahlungen freigeschaltet sind, würden wir den großen "Become a customer" button durch ein Formular zur Eingabe der Kreditkartendaten ersetzen.
assert();
def patiently(&block)
cycles = 0
begin
yield
rescue => e
cycles += 1
sleep 0.1
if cycles < 10
retry
else
# chef recipe for installing couchdb
execute 'install couchdb dev dependencies' do
command "apt-get -y build-dep couchdb"
end
%w(xulrunner-dev libicu-dev libcurl4-gnutls-dev libtool).each do |name|
package name do
action :install
end
var styles = heredoc(function() {
/*
<style>
.my_css {
...
}
</style>
*/
});
office assistant at upstream
upstream is looking for a freelance office assistant for a few hours per week.
you:
* should be (mostly) available during office hours
* should check your email at least twice a day
* should know your way around the web
* should speak perfect german and fluent english
@langalex
langalex / upstream_rails_application_template.rb
Created March 6, 2009 19:49
upstream rails application template
# rails application template for generating customized rails apps
#
# == requires ==
#
# * rails 2.3+, rspec, cucumber, culerity (langalex-culerity gem), machinist
#
# == a newly generated app using this template comes with ==
#
# * working user registration/login via authlogic, cucumber features to verify that it works
# * rspec/cucumber/culerity for testing
#!/usr/bin/env ruby
pids = %x[ps ax|grep rails|grep -v grep].split("\n").map{|line| line.strip.scan(/^\d+/).first.to_i} - [Process.pid]
if pids.any?
system "kill #{pids.join(' ')}"
puts "killed #{pids.size} rails instance(s)"
else
puts "no rails processes found"
end