Skip to content

Instantly share code, notes, and snippets.

View MSch's full-sized avatar

Martin Schürrer MSch

View GitHub Profile
@MSch
MSch / xcode_auto_versioning.rb
Created May 24, 2011 19:56 — forked from bgreenlee/xcode_auto_versioning.rb
Xcode Auto-Versioning: Updates your Info.plist's CFBundleVersion with the current git tag and/or sha.
# Xcode Auto-Versioning
#
# Updates your Info.plist's CFBundleVersion with the current git tag and/or sha.
#
# based on https://github.com/elliottcable/xcode-git-versioner
#
# Usage:
# 1. Right-click the target you want to add the versioning phase to (usually the target that builds your app)
# 2. Select: Add -> New Build Phase -> New Run Script Build Phase
# 3. Specify /usr/bin/env ruby as the shell for the script
@MSch
MSch / .vimrc
Created July 3, 2011 16:58
JavaScript highlighting inside underscore.js templates for vim
" Add this to the bottom of your ~/.vimrc to enable jst highlighting
au BufNewFile,BufRead *.jst set syntax=jst
@MSch
MSch / gist:285999
Created January 25, 2010 16:41
Mitschrift vom Steuerrecht Gastvortrag
Mag. jur. Köger, 40 Jahre Finanzverwaltung
www.bmf.gv.at
- SelbständigenBuch
- Findok (Finanzdokumentation)
Mögliche Organisationsformen:
- Einzelfirma
- Personengesellschaft
Anfang keine bezahlten Angestellten, alle die hakln sind beteiligt
@MSch
MSch / thread.rb
Last active January 2, 2016 09:09
module ActiveRecord
class Connection
def connect
Thread.current.thread_variable_set(:connection_id, 123)
end
end
end
module Sequel
class Connection
@MSch
MSch / azet.rb
Created September 27, 2013 14:38
$state = 0
def lol(x, y)
$state += 1
puts "Incrementing state it's now #{$state}"
[:bla, $state]
end
a, e = lol(:screw, :this) until e == 3
puts "a=#{a} e=#{e}"
@MSch
MSch / azet.rb
Created September 27, 2013 14:38
$state = 0
def lol(x, y)
$state += 1
puts "Incrementing state it's now #{$state}"
[:bla, $state]
end
a, e = lol(:screw, :this) until e == 3
puts "a=#{a} e=#{e}"
% brew --config :(
HOMEBREW_VERSION: 0.9.4
ORIGIN: https://github.com/mxcl/homebrew.git
HEAD: ba09af5da322ce5506be593629a20835702c5d26
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: quad-core 64-bit arrandale
OS X: 10.8.4-x86_64
Xcode: 5.0 => /Applications/Xcode5-DP5.app/Contents/Developer
CLT: 5.0.0.0.1.1372877146
self.collectionView = ({
UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
UICollectionView *collectionView = [[UICollectionView alloc] initWithFrame:self.view.bounds
collectionViewLayout:flowLayout];
collectionView.delegate = self;
collectionView.dataSource = self;
collectionView;
@MSch
MSch / fix_model_name.rb
Created June 21, 2013 18:23
If you prefer to keep your models namespaced then ActiveModel::Naming really makes that harder for you than it would have to be.
module MyApp::ModelNameFix
def model_name
@_model_name ||= ActiveModel::Name.new(self, nil, self.name.sub(/^#{self.parent.name}::/, ''))
end
def namespaced_model_name
@_namespaced_model_name ||= ActiveModel::Name.new(self)
end
# Work with Draper
<msch> RhodiumToad: so the simple advice is, "always use timestamptz, never timestamp"?
<RhodiumToad> when storing a future time, the way to decide is this:
<RhodiumToad> there are a few apps where timestamp without time zone has its uses.
<RhodiumToad> e.g. things like calendaring / scheduling which are dealing mostly in future times
<RhodiumToad> does it matter how many seconds/minutes/hours there are between now and then,
<RhodiumToad> or does it matter what the clock on the wall will read then
<RhodiumToad> in the first case you need timestamptz, in the second case, timestamp without time zone,
<RhodiumToad> possibly with a separate field (possibly in some other table) storing the timezone name
<RhodiumToad> otherwise, you run into the same problem that many calendaring apps did when the US DST rules were changed