Skip to content

Instantly share code, notes, and snippets.

@joethephish
joethephish / gist:09d12d80bd0a98c16670
Created December 9, 2014 12:44
Thumbnail Jekyll plugin
# Generates a thumbnail image and returns its path, given a path to the full image.
# Hacked from various existing plugins, particularly:
# https://github.com/mrdanadams/jekyll-thumbnailer/blob/master/thumbnail.rb
# https://github.com/10io/jekyll-thumbnailify/blob/master/jekyll-thumbnailify.rb
#
# Doesn't require ImageMagick, and instead uses the Apple Developer tool sips, so
# only works when generated on a Mac. Could easily replace sips with ImageMagick again.
#
# Usage:
#
@joethephish
joethephish / Dangerous NSArray count
Created June 29, 2013 18:02
The dangers of using [NSArray count] in if statements! (because count is an NSUInteger)
NSArray *array = @[@"a", @"b"];
if( array.count - 3 >= 5 ) {
NSLog(@"Big!");
} else {
NSLog(@"Small!");
}
// --> Big!