Skip to content

Instantly share code, notes, and snippets.

View code-later's full-sized avatar

Dirk Breuer code-later

View GitHub Profile
[color]
diff = auto
status = auto
branch = auto
interactive = auto
[alias]
br = branch
st = status
ci = commit -m
ca = commit -a -m
@code-later
code-later / mt_to_markdown.rb
Created April 10, 2012 12:28
Convert a MovableType export to single Markdown posts to use with Octopress
#!/usr/bin/env ruby
require 'date'
require 'mustache'
require 'stringex'
require 'cgi'
export = File.open(ARGV[0])
target_dir = ARGV[1]
@code-later
code-later / gist:2780882
Created May 24, 2012 11:23
Search & Replace across files in Vim
" Select files to work on with :args
:args app/views/*/*
" Perform any action on the previous selected files
:argdo %s/search/replace/gec | update
@code-later
code-later / class.c
Created June 21, 2012 06:43
Is Ruby's put implemented with method_missing?
// The 'rb_define_global_function' can be found in class.c
/*!
* Defines a global function
* \param name name of the function
* \param func the method body
* \param argc the number of parameters, or -1 or -2. see \ref defmethod.
*/
void
rb_define_global_function(const char *name, VALUE (*func)(ANYARGS), int argc)
@code-later
code-later / a.md
Created June 29, 2012 08:57 — forked from tisba/a.md

This allows you to use the following video streaming services outside of the US from your Mac without having to use a proxy or VPN, so no big bandwidth issues:

  • Netflix
  • Hulu / HuluPlus
  • CBS
  • ABC
  • MTV
  • theWB
  • CW TV
  • Crackle
@code-later
code-later / gist:3137064
Created July 18, 2012 15:49
Run Ruby from a Vim buffer
autocmd FileType ruby compiler ruby
function Run()
let executable=b:current_compiler
if !getbufvar("%", "&saved")
let tmpfile = tempname()
silent! exe "write " . tmpfile . ".rb"
endif
@code-later
code-later / multiple_ssh_tunnels.rb
Created January 9, 2013 08:58
Open multiple SSH tunnels to forward resque-web instances via Capistrano.
Capistrano::Configuration.instance(:must_exist).load do
set :resque_local_start_port, 7070
set :resque_remote_port, 8282
def resque_local_ports
@resque_local_ports ||= Enumerator.new do |yielder|
current_port = fetch(:resque_local_start_port)
loop do
yielder.yield current_port
current_port += 1
# Verdienstziele und weitere Parameter
# ===============================================================================================
Jahr=2012
# Gewerbesteuer berücksichtigen, "ja" oder "nein"?
GewerbesteuerEinrechnen = "nein"
# Jeweilige Jahresziele sollten in 10 Monaten erreicht werden
# ...wegen Weiterbildungen, Urlaub, Krankheit, Open Source Contribution
# MaxStd entspricht dabei dann 100% Auslastung
class Gateway
attr_reader :connection
def initialize(connection = Application.config.default_connection)
@connection = connection
end
def get(params)
request(:get, params)
end
@code-later
code-later / README.markdown
Created June 10, 2013 09:28
base16 color scheme

This is my color scheme definition to be used with @chriskempson base16 builder. It is based on the original base16 color set with some pink modifications. I use the resulting 256 colors variant.