Skip to content

Instantly share code, notes, and snippets.

View tessi's full-sized avatar

Philipp Tessenow tessi

View GitHub Profile

Jumping, Finding, ...

Keybinding - Description
Ctrl-1 - Move to 1st tab (work every number)
Ctrl-p - Go to anything
Ctrl-g - Go to line
Ctrl-r - Go to symbol (e.g. section and labels)
Ctrl-m - Move to bracket
@tessi
tessi / keybase.md
Last active August 29, 2015 13:58
keybase.md

Keybase proof

I hereby claim:

  • I am tessi on github.
  • I am tessi (https://keybase.io/tessi) on keybase.
  • I have a public key whose fingerprint is A948 40E0 C745 A694 C9F2 C221 E01F 12D7 8B9B 048D

To claim this, I am signing this object:

@tessi
tessi / traceback
Created December 2, 2010 20:05
NoMethodError: undefined method `compile' for nil:NilClass
NoMethodError: undefined method `compile' for nil:NilClass
/home/philipp/.rvm/gems/ruby-1.8.7-p302@metachello/gems/coffee-script-2.1.1/lib/coffee_script.rb:170:in `compile'
/home/philipp/.rvm/gems/ruby-1.8.7-p302@metachello/gems/tilt-1.1/lib/tilt.rb:618:in `evaluate'
/home/philipp/.rvm/gems/ruby-1.8.7-p302@metachello/gems/tilt-1.1/lib/tilt.rb:128:in `render'
/home/philipp/.rvm/gems/ruby-1.8.7-p302@metachello/gems/sinatra-1.1.0/lib/sinatra/base.rb:452:in `render'
/home/philipp/.rvm/gems/ruby-1.8.7-p302@metachello/gems/sinatra-1.1.0/lib/sinatra/base.rb:418:in `coffee'
metacello.rb:138:in `GET /javascript/:name.js'
/home/philipp/.rvm/gems/ruby-1.8.7-p302@metachello/gems/sinatra-1.1.0/lib/sinatra/base.rb:1032:in `call'
/home/philipp/.rvm/gems/ruby-1.8.7-p302@metachello/gems/sinatra-1.1.0/lib/sinatra/base.rb:1032:in `compile!'
/home/philipp/.rvm/gems/ruby-1.8.7-p302@metachello/gems/sinatra-1.1.0/lib/sinatra/base.rb:620:in `instance_eval'
@tessi
tessi / insult.rb
Created July 20, 2011 09:46
if you need an insult to work faster...
require 'nokogiri'
require 'open-uri'
# thanks to Rosalily for the list of insults
doc = Nokogiri::HTML(open('http://www.cloudnet.com/~renfest/insults.htm'))
# works fine if you need positive feedback too ;)
# http://hubpages.com/hub/List-Of-Positive-Daily-Affirmations
insults = doc.at_css('body ul ul ul ul ul').children.select {|c| c.name =='li'}.map {|c| c.children[0].text}
loop { %x{ say "#{insults.shuffle.first.upcase}"; sleep #{rand(10000)+1000} } }
@tessi
tessi / gist:4131737
Created November 22, 2012 15:34
little benchmark for time bundle exec rake routes

Time taken with following command: time bundle exec rake routes twice for every MRI 1.9.3 variation explained in this blogpost for my OpenProject installation.

  • 1.9.3
    real    0m18.319s
    user    0m15.929s
    

sys 0m1.452s

@tessi
tessi / HowToBuildOnModernUbuntu64bit.md
Last active December 14, 2015 22:39
nscogbuild script for a modern ubuntu 64bit system

How To Compile Cog VM on Ubuntu 12.10 64bit

Disclaimer: I used these instructions and the ubuntu_mvm script to build a Newspeak VM. However, this should be easily adaptable to a Squeak Cog build. It probably works on other modern linux systems, but I haven't tested any other distro. Please tell me if it does (not) work for you.

require 'ostruct'
include ActionView::Helpers::FormOptionsHelper
# fake ActiveRecord models
class Continent < OpenStruct
#attr_accessor :id, :name, :countries
def initialize(*args)
super
@tessi
tessi / gist:5907238
Created July 2, 2013 06:55
installing debugger failed with ruby1.9.3p448 on Travis CI
[...]
Installing debugger-ruby_core_source (1.2.2)
Installing debugger (1.6.0)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/home/travis/.rvm/rubies/ruby-1.9.3-p448/bin/ruby extconf.rb
checking for rb_method_entry_t.called_id in method.h... no
@tessi
tessi / delegator
Last active December 19, 2015 12:49
Observe Hash#[]=
class SnakeHash < SimpleDelegator
def []=(arg1, arg2)
puts "!!1!"
@delegate_sd_obj[arg1] = arg2
end
end
#[2] pry(main)> h = SnakeHash.new(Hash.new)
#=> {}
#[3] pry(main)> h[2]
Entry = Struct.new(:timestamp, :clientID, :objectID, :size, :method, :status, :type, :server) do
REGIONS = [:SantaClara, :Plano, :Herndon, :Paris]
PROTOCOLS = [:HTTP_09, :HTTP_10, :HTTP_11, :HTTP_XX]
METHODS = [:get, :head, :post, :put, :delete, :trace, :options, :connect, :other]
STATUS_CODES = [100, 101, 200, 201, 202, 203, 204, 205, 206, 300, 301, 302, 303, 304, 305, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 500, 501, 502, 503, 504, 505, :other]
FILE_TYPES = [:html, :image, :audio, :video, :java, :formatted, :dynamic, :text, :compressed, :programs, :directory, :icl, :other]
def self.parse(bytes)
values = bytes.unpack("NNNNCCCC")
entry = self.new