Skip to content

Instantly share code, notes, and snippets.

View njdehoog's full-sized avatar

Niels de Hoog njdehoog

View GitHub Profile
@andrewgleave
andrewgleave / iOSMapKitFitAnnotations.m
Last active May 17, 2024 02:07
Zooms out a MKMapView to enclose all its annotations (inc. current location)
MKMapRect zoomRect = MKMapRectNull;
for (id <MKAnnotation> annotation in mapView.annotations) {
MKMapPoint annotationPoint = MKMapPointForCoordinate(annotation.coordinate);
MKMapRect pointRect = MKMapRectMake(annotationPoint.x, annotationPoint.y, 0, 0);
if (MKMapRectIsNull(zoomRect)) {
zoomRect = pointRect;
} else {
zoomRect = MKMapRectUnion(zoomRect, pointRect);
}
}
@artero
artero / launch_sublime_from_terminal.markdown
Last active September 12, 2024 02:13 — forked from olivierlacan/launch_sublime_from_terminal.markdown
Launch Sublime Text 2 from the Mac OS X Terminal

Launch Sublime Text 2 from the Mac OS X Terminal

Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.

open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl

You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html

Installation

@chrx
chrx / retinafy_tmx.py
Created November 28, 2011 05:26
Adjust a TMX map file created in Tiled for use with the retina display in Cocos2d
#!/usr/bin/env python
u"""
Upscales a Tiled TMX map for use with a retina display.
Fixes tile size, object position and size, image size.
Saves the retina file as filename-hd.tmx in the same folder as the source file.
"""
anonymous
anonymous / MWeakRefCollection.h
Created January 9, 2013 10:52
Weak reference version of NSMutableArray and NSMutableSet. Use associated object to watch dealloc of objects and remove them when deallocated.
#import <Foundation/Foundation.h>
@interface NSObject (MDeallocObserver)
- (void)addDeallocObserverBlock:(void (^)(void))block;
- (void)addDeallocObserverWithKey:(id<NSCopying>)key block:(void (^)(void))block;
- (void)removeDeallocObserverForKey:(id<NSCopying>)key;
@end
@zenorocha
zenorocha / README.md
Last active August 22, 2024 14:20
A template for Github READMEs (Markdown) + Sublime Snippet

Project Name

TODO: Write a project description

Installation

TODO: Describe the installation process

Usage

@jbenet
jbenet / simple-git-branching-model.md
Last active November 9, 2024 04:55
a simple git branching model

a simple git branching model (written in 2013)

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.

@eelco
eelco / git-clean-merge
Last active November 8, 2016 22:21
Script to merge branches in a way that keeps the repository history nice and clean.
#!/bin/bash
# Use the current branch as the source
SOURCE_BRANCH=`git rev-parse --abbrev-ref HEAD`
TARGET_BRANCH=${1:-master}
if [ "$SOURCE_BRANCH" = "" ]; then
# Something went wrong, but git probably already said what, just exit.
exit 1;
fi
@im6e
im6e / NSLog_Macro
Created February 1, 2014 10:27
NSLog macro
#ifdef DEBUG
# ifndef DLog
# define DLog(__FORMAT__,...) NSLog((@"%s [Line %d] " __FORMAT__), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
# endif
#else
# ifndef DLog
# define DLog(...) /* */
# endif
#endif /* if DEBUG */
@justinmc
justinmc / gist:9837998
Last active February 2, 2019 21:14
SASS Zigzag Border
/* border-serrated - a zig zag triangle border with linear gradient
*/
@mixin border-top-serrated($size, $color-outer) {
& {
position: relative;
overflow: auto;
padding-top: $size;
}
&:before {
top: 0px;
@pedrogpimenta
pedrogpimenta / convert sass to scss
Created April 11, 2014 16:51
Convert SASS to SCSS and delete .sass files (applies to all files in current folder)
sass-convert -R ./ -F sass -T scss && rm *.sass