Skip to content

Instantly share code, notes, and snippets.

@elvio
elvio / gist:6007036
Last active December 19, 2015 19:38
if ENV["DATABASE_URL"]
db = URI.parse(ENV["DATABASE_URL"])¬
db_scheme = db.scheme == 'postgres' ? 'postgresql' : db.scheme¬
options = {¬
:adapter => db_scheme,¬
:host => db.host,¬
:username => db.user,¬
Original
------------------------------------------------------------
9 + <% t = first.starts_at %>
10 + <% if t.today? %>
11 + <%= I18n.t("landing.today") %>
12 + <% elsif t.tomorrow? %>
13 + <%= I18n.t("landing.tomorrow") %>
14 + <% else %>
15 + <%= I18n.l t, :format => :short %>
16 + <% end %>
require 'bundler/capistrano'
set :application, "net"
set :repository, "[email protected]:net.git"
set :scm, :git
set :default_environment, {
'PATH' => "$HOME/.rbenv/shims:$HOME/.rbenv/bin:$PATH"
}
@elvio
elvio / bootstrap.sh
Last active December 19, 2015 12:39
Bootstrap Chef solo
#!/usr/bin/env bash
sudo apt-get -y update
sudo apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev git
cd /tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz
tar -xvzf ruby-1.9.3-p125.tar.gz
cd ruby-1.9.3-p125/
sudo ./configure --prefix=/usr/local
sudo make
sudo make install
{
catchup: [
{
video_id: 68523,
time_starts_at: null,
time_ends_at: null,
title_en: "Das unsichtbare Mädchen",
title_de: "Das unsichtbare Mädchen",
genre_en: null,
genre_de: null
@elvio
elvio / ring.erl
Created April 23, 2013 15:28
Erlang Ring example
-module(ring).
-export([build/1, ring_node/2, loop/1]).
build(N) ->
Manager = self(),
register(ring, Manager),
Root = spawn(?MODULE, ring_node, [null, Manager]),
Root ! {create, N},
loop(N).
osascript -e 'say "Dum la dum fa la la dum he dum dum fa dum dum la fa hoo hoo hoo dum dum lah fa he he he dum" using "Cellos"'
class PhonesController < ApplicationController
active_scaffold :phone
end
class User < ActiveRecord::Base
has_many :phones
end
class Phone < ActiveRecord::Base
belongs_to :user
end
class UsersController < ApplicationController
active_scaffold :user
end