Skip to content

Instantly share code, notes, and snippets.

View timoschilling's full-sized avatar
👻
yolo

Timo Schilling timoschilling

👻
yolo
View GitHub Profile
@timoschilling
timoschilling / rake
Last active August 26, 2015 14:27
demo simple rake
#!/usr/bin/env ruby
require "./rake_lib"
require "./test_task"
exec ARGV.first.to_sym
@timoschilling
timoschilling / twin.rb
Created September 10, 2015 09:20
Disposible::Twin.fake
class Disposable
class Twin
def self.fake
types = {}
representer_class.representable_attrs[:definitions].each_pair do |key, value|
types[key] = value.instance_variable_get(:@options)[:type]
end
attributes = {}
puts types
types.each_pair do |key, type|
@timoschilling
timoschilling / FritzBox_iPhone_VPN_Setup.txt
Created November 1, 2010 13:39
Example of a FritzBox <-> iPhone VPN Setup
vpncfg {
connections {
enabled = yes;
conn_type = conntype_user;
name = "iPhone";
always_renew = no;
reject_not_encrypted = no;
dont_filter_netbios = yes;
localip = 0.0.0.0;
local_virtualip = 0.0.0.0;
@timoschilling
timoschilling / jquery_dom_load.js
Created March 2, 2011 01:36
jQuery snippet that simulates the DOM building via https://twitter.com/jquery/status/42756061685497856
jQuery(function($) {
(function n(e){
e.eq(0).fadeIn(99,
function(){
n(e.slice(1))
}
)}
)($(":visible").hide())
})
@timoschilling
timoschilling / aliases.sh
Created May 12, 2011 12:15
my bash aliases
alias l='ls -la'
alias ..='cd ..'
alias r='rails'
alias rs='rails server'
alias rc='rails console'
alias pubkey='cat .ssh/id_rsa.pub | pbcopy'
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/[\1]/'
}
export PS1="\[\e[0m\]\w\[\e[0m\]\$(parse_git_branch) \$ "
@timoschilling
timoschilling / unsubscribe.rb
Created September 29, 2015 15:00
ActiveSupport::Notifications unsubscribe by regex
ActiveSupport::Subscriber.subscribers.flat_map(&:patterns).grep(/trailblazer/).map &ActiveSupport::Notifications.method(:unsubscribe)
@timoschilling
timoschilling / .tm_properties
Created April 28, 2012 15:02
textmate config
#http://wiki.macromates.com/Reference/Settings
fontSize = 12
fontName = Monaco
showInvisibles = true
spellChecking= true
excludeInFileChooser = "{$exclude,public/uploads/assets,\.git,\.sass-cache/}"
windowTitle = "$TM_DISPLAYNAME${TM_DIRECTORY/\A(?:\/Users\/captainhagbard\w+\/?(.*)|(.+))\z/${2:? – ${2/\A\/Users\/captainhagbard/~/}:${1/\A(?=.)/ – /}}/}"
@timoschilling
timoschilling / nrt2tokyo.rb
Created June 20, 2012 09:35 — forked from melborne/nrt2tokyo.rb
Solve optimal path from Narita to Tokyo with inject
class OptimalPath
def initialize(road_system)
@road_system = road_system
end
def solve
bestA, bestB =
@road_system.inject([Path.new, Path.new]) do |(pathA, pathB), section|
road_step(pathA, pathB, section)
end
sort $HISTFILE | uniq -c | sort -k1 -rn | head -n 30