Skip to content

Instantly share code, notes, and snippets.

View elmoswelt's full-sized avatar

Elmar Tampe elmoswelt

View GitHub Profile
public class ContainerCollectionViewCell<ContainedView: UIView>: UICollectionViewCell {
// MARK: - Properties
public let containedView = ContainedView()
//MARK: Initialization
override public init(frame: CGRect) {
super.init(frame: frame)
setup()
}
@elmoswelt
elmoswelt / Todo and Fixme warnings
Created May 21, 2015 11:39
Treat FIXME and TODO as warnings.
find "${SRCROOT}" \( -name "*.h" -or -name "*.m" \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($KEYWORDS).*\$" | perl -p -e "s/($KEYWORDS)/ warning: \$1/"
@elmoswelt
elmoswelt / unusedImages.sh
Created July 29, 2012 16:10 — forked from vibrazy/unusedImages.sh
How to find unused images in an XCode project?
#!/bin/sh
# -------
# Usage sh unusedImages.sh (jpg|png|gif)
# -------
# Caveat
# 1 -
# NSString *imageName = [NSString stringWithFormat:@"image_%d.png", 1];
# This script would incorrectly list these images as unreferenced. For example, you might have
# This script will incorrectly think image_1.png is unreferenced.
# 2 - If you have a method, or variable with the same name as the image it won't pick it up
@elmoswelt
elmoswelt / Git log alias
Created July 25, 2012 19:38
Git log looking nice
[alias]
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --
@elmoswelt
elmoswelt / Prefix.pch
Last active October 7, 2015 07:07
Logging and assertion macros
Source: http://www.cimgf.com/2010/05/02/my-current-prefix-pch-file/
// Logging
#ifdef DEBUG
#define DLog(...) NSLog(@"%s %@", __PRETTY_FUNCTION__, [NSString stringWithFormat:__VA_ARGS__])
#define ALog(...) [[NSAssertionHandler currentHandler] handleFailureInFunction:[NSString stringWithCString:__PRETTY_FUNCTION__ encoding:NSUTF8StringEncoding] file:[NSString stringWithCString:__FILE__ encoding:NSUTF8StringEncoding] lineNumber:__LINE__ description:__VA_ARGS__]
#else
#define DLog(...) do { } while (0)
#ifndef NS_BLOCK_ASSERTIONS
#define NS_BLOCK_ASSERTIONS
# define ALog(format, ...) NSLog((@"%s [L%d] " format), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
# ifdef DEBUG
# define DLog(format, ...) ALog(format, ##__VA_ARGS__);
# else
# define DLog(...)
# endif
Create git Repo
---------------
cd my_project
git init
git add *
git commit -m "My initial commit message"
git remote add origin [email protected]:my_project.git
git push -u origin master
@elmoswelt
elmoswelt / hack.sh
Created April 1, 2012 12:27 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@elmoswelt
elmoswelt / removeRemote.sh
Created February 29, 2012 21:30 — forked from larsxschneider/removeRemote.sh
Remove all merged branches on a Github
git branch -a --merged | grep "remotes/origin/" | grep -v "remotes/origin/HEAD" | grep -v "remotes/origin/master" | xargs -n 1 basename | xargs -n 1 -I {} sh -c 'echo "Deleting" {}; git branch -d {}; git push --delete origin {}; git branch -dr {}'