Skip to content

Instantly share code, notes, and snippets.

Avatar

Mattes Groeger MattesGroeger

View GitHub Profile
@MattesGroeger
MattesGroeger / applause-template
Last active Oct 11, 2018
Use this template for communicating changes to Applause
View applause-template
*Version : x.x.x (Build xxxx)*
*_TITLE OF THIS RELEASE_*
*Description:*
• *Section:* change
• ...
*Bug fixes:*
• Fixed ...
@MattesGroeger
MattesGroeger / Example.swift
Created Jun 21, 2017
Generic in-memory cache implementation for Swift 3.0
View Example.swift
// create a chache with 60 seconds expiration time
var cache: InMemoryCache = InMemoryCache<LocalUrl>(expirationInSeconds: 60)
// data will either be returned from cache or created via callback and then returned
let data = cache.cachedData {
// do the heavy object creation here
return MyHeavyObject()
}
// invalidate the cache, next call will have to re-create the heavy object
@MattesGroeger
MattesGroeger / CAMediaTimingFunctionExtension.swift
Created Aug 12, 2016
This Swift extension allows to use more timing functions than the default ones provided by `CAMediaTimingFunction`. It's based on the work of Christian Giordano: https://gist.github.com/nuthinking/7415509
View CAMediaTimingFunctionExtension.swift
import QuartzCore
enum BezierType {
case Default
case Linear
case EaseIn
case EaseOut
case EaseInOut
@MattesGroeger
MattesGroeger / Rakefile
Last active Jan 4, 2016
Run commands from Ruby (e.g. Rakefile) with real time output and exiting on non-0 exit codes.
View Rakefile
desc 'Build'
task :build do
run("xbuild Project.sln", "Build failed")
run("nunit-console Tests/bin/Debug/Project-Tests.dll", "Tests failed")
run("mono Tests/vendor/NSpecRunner.exe Tests/bin/Debug/Project-Tests.dll", "Specs failed")
end
task :default => :demo
# This is the important method
@MattesGroeger
MattesGroeger / vb_bootcamp.sh
Created Jan 18, 2014
I use the following script to boot my Windows 7 bootcamp partition under OSX with VirtualBox. Replace the name of your Bootcamp partition and the name of your VirtualBox image accordingly. The script was written after following this description: http://www.kevinrockwood.info/2010/04/windows7-in-osx-with-bootcamp-and-virtualbox/
View vb_bootcamp.sh
#!/bin/sh
# find and unmount volume (change 'BOOTCAMP' name accordingly)
amount=`diskutil list | grep BOOTCAMP | wc -l`
if [ $amount = 1 ]
then
path=`diskutil list | grep BOOTCAMP | sed -e 's/^\(.*\)\(disk0s.\)$/\/dev\/\2/g'`
sudo chmod 777 $path
diskutil unmount $path
fi
View mono.rb
# http://www.mono-project.com/Compiling_Mono_on_OSX
require 'formula'
class Mono < Formula
url 'http://download.mono-project.com/sources/mono/mono-3.2.3.tar.bz2'
homepage 'http://www.mono-project.com/'
sha1 'e356280ae45beaac6476824d551b094cd12e03b9'
def install
@MattesGroeger
MattesGroeger / Kiwi (new)
Created Nov 8, 2013
I just re-factored this OCUnit code to Kiwi
View Kiwi (new)
[[[user1Dict[@"highscores"] valueForKey:@"fb_id"] should] contain:fbId_user2];
[[[user2Dict[@"highscores"] valueForKey:@"fb_id"] should] contain:fbId_user1];
@MattesGroeger
MattesGroeger / UIImageView+Mask.h
Last active Dec 17, 2015
With this category of `UIImageView` you can apply a mask (grey-scale jpg) onto a given image. The mask is then applied on that existing image. With this technique you can use 2 compressed JPG's (not transparent image + mask) rather than one big PNG file.
View UIImageView+Mask.h
#import <Foundation/Foundation.h>
@interface UIImageView (Mask)
- (void)applyMask:(NSString *)maskName;
@end
@MattesGroeger
MattesGroeger / NSNotificationMatcher.h
Created Nov 13, 2012
Matcher for Kiwi testing framework that allows testing notifications.
View NSNotificationMatcher.h
#import "KWHCMatcher.h"
#import "KWMessageTracker.h"
#import "Kiwi.h"
@interface NSNotificationMatcher : NSObject <HCMatcher>
{
NSDictionary *_userInfo;
}
+ (id)matcherWithUserInfo:(NSDictionary *)dictionary;
@MattesGroeger
MattesGroeger / .zshrc
Created Nov 25, 2011
My .zshrc (part), gitconfig and diff_merge.sh for opening git diffs with DiffMerge app
View .zshrc
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
plugins=(git osx brew svn)
# Normal aliases
alias gco='git co'
alias gci='git ci'
alias grb='git rb'
alias d='git diff --word-diff $@'
alias c='git commit -v $@'
alias s='git status -sb'