Skip to content

Instantly share code, notes, and snippets.

View mrrooijen's full-sized avatar

Michael van Rooijen mrrooijen

View GitHub Profile
@mrrooijen
mrrooijen / Rakefile.rb
Created August 9, 2011 22:33 — forked from carlhoerberg/Rakefile.rb
How to do automatic backup with Heroku PGBackups and Heroku Cron. http://carlhoerberg.com/automatic-backup-of-heroku-database-to-s3
require 'aws/s3'
require 'heroku'
require 'heroku/command'
require 'heroku/command/auth'
require 'heroku/command/pgbackups'
task :cron do
class Heroku::Auth
def self.client
Heroku::Client.new ENV['heroku_login'], ENV['heroku_passwd']
@mrrooijen
mrrooijen / assets.rake
Created December 11, 2011 20:22 — forked from rmm5t/assets.rake
Precompile assets on Heroku with Mongoid
# The premise behind this was borrowed from https://gist.github.com/1239732
namespace :assets do
# Prepend the assets:prepare task to assets:precompile through
# assets:environment
task :environment => :prepare
task :prepare do
# Flag for custom initializers to know we're precompiling assets
ENV["RAILS_ASSETS_PRECOMPILE"] = "true"
@mrrooijen
mrrooijen / gist:2225514
Created March 28, 2012 11:22 — forked from nvie/gist:2225508
zsh-sourcing.txt
#
# .zshenv
# .zshenv is the 1st file zsh reads; it's read for every shell, even if
# started with -f (setopt NO_RCS)
# .zprofile
# read after zshenv, if the shell is a login shell
# .zshrc
# read after zprofile, if the shell is an interactive shell
# .zlogin
# read after zshrc, if the shell is a login shell
Mail = Ember.Application.create();
// Let's pretend that Javascript can handle mutliline strings nicely:
Mail.ApplicationView = Ember.View.extend({
template: Ember.Handlebars.compile('
<!-- this gets replaced with content based on state when
connectOutlet is called on ApplicationController -->
{{outlet}}
@mrrooijen
mrrooijen / gist:3926859
Created October 21, 2012 12:35 — forked from Jared-Prime/gist:2423065
Converting RGB to HEX in Ruby
# Beginning Rubyists: simply run >> ruby hex-convertions.rb to see examples
# or use irb to build the code on the fly
# you can convert HEX to DEC using the method .to_i(base),
# which converts a string to a decimal number from the specified base number
puts "00".to_i(16)
puts "FF".to_i(16)
source :rubygems
gem 'shotgun', :group=>:development
gem 'rack-cache'
gem 'sinatra', :require => 'sinatra/base'
gem 'sinatra-support'
gem 'haml'
# Stick this in lib/tasks/assets.rake or similar
#
# A bug was introduced in rails in 7f1a666d causing the whole application cache
# to be cleared everytime a precompile is run, but it is not neccesary and just
# slows down precompiling.
#
# Secondary consequences are the clearing of the whole cache, which if using
# the default file cache could cause an application level performance hit.
#
# This is already fixed in sprockets-rails for rails 4, but we patch here for
require 'faye'
Faye::WebSocket.load_adapter('thin')
use Faye::RackAdapter, :mount => '/faye', :timeout => 25
require ::File.expand_path('../config/environment', __FILE__)
run App::Application
@mrrooijen
mrrooijen / Makefile
Created November 27, 2013 02:20 — forked from border/Makefile
include $(GOROOT)/src/Make.inc
GOFMT=gofmt -spaces=true -tabindent=false -tabwidth=4
all:
$(GC) jsontest.go
$(LD) -o jsontest.out jsontest.$O
format:
$(GOFMT) -w jsontest.go
@mrrooijen
mrrooijen / go_scp.go
Created November 28, 2013 16:00 — forked from jedy/go_scp.go
// https://blogs.oracle.com/janp/entry/how_the_scp_protocol_works
package main
import (
"code.google.com/p/go.crypto/ssh"
"crypto"
"crypto/rsa"
"crypto/x509"
"encoding/pem"
"fmt"