Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View langalex's full-sized avatar

Alexander Lang langalex

View GitHub Profile
#!/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
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
var styles = heredoc(function() {
/*
<style>
.my_css {
...
}
</style>
*/
});
# 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
def patiently(&block)
cycles = 0
begin
yield
rescue => e
cycles += 1
sleep 0.1
if cycles < 10
retry
else
assert();
@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.
@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 / credits.rb
Created April 21, 2012 23:19
Ruby Script to generate the intro and credits for my Railsgirls Berlin film
# encoding: utf-8
require_relative 'type'
require 'yaml'
30.times {puts}
sleep 2
command '"That was: #{event.name} #{Location.current} #{Date.today.year}"', "=> That was: Railsgirls Berlin 2012"
@langalex
langalex / login.sh
Created June 15, 2012 14:37
Logging in to the hotel wifi at Nordic Ruby 2012
# take one of the wifi cards from the bar and fill in the blanks
# this wil log you into the hotel wifi without having to type in the username/password every time
curl -XPOST -d "username=<username>&password=<password>&operator=homerun.telia.com" https://login.homerun.telia.com/sd/login