Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
f=$(pwd)
sips --resampleWidth 1024 "${f}/${1}" --out "${f}/iTunesArtwork@2x.png"
sips --resampleWidth 57 "${f}/${1}" --out "${f}/app-icon.png"
sips --resampleWidth 114 "${f}/${1}" --out "${f}/app-icon@2x.png"
sips --resampleWidth 29 "${f}/${1}" --out "${f}/app-icon-29.png"
sips --resampleWidth 58 "${f}/${1}" --out "${f}/app-icon-29@2x.png"
@ppm
ppm / gist:7254204
Created October 31, 2013 18:07
Response to animated/interactive UIViewController transition.
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self.transitionCoordinator animateAlongsideTransition:nil completion:^(id<UIViewControllerTransitionCoordinatorContext> context) {
if ( [context initiallyInteractive] ) return;
[self _onTransitionEnd:context];
}];
[self.transitionCoordinator notifyWhenInteractionEndsUsingBlock:^(id<UIViewControllerTransitionCoordinatorContext> context) {
[self _onTransitionEnd:context];
@rpearce
rpearce / facebook_oauth_fix
Created July 31, 2013 15:56
jQuery fix for annoying #_=_ returned from Facebook Oauth
$(window).on('load', function(e) {
if (window.location.hash == '#_=_') {
window.location.hash = ''; // for older browsers, leaves a # behind
history.replaceState('', document.title, window.location.pathname); // nice and clean
e.preventDefault(); // no page reload
}
});
@jbroadway
jbroadway / Slimdown.md
Last active February 5, 2024 10:43
Slimdown - A simple regex-based Markdown parser.
@bignerdranch
bignerdranch / BNRTimeBlock.h
Created March 9, 2012 13:51
Timing Utility Post 20120308
CGFloat BNRTimeBlock (void (^block)(void));
@Jaybles
Jaybles / UIDeviceHardware.h
Created October 28, 2011 19:33
UIDeviceHardware - Determine iOS device being used
//
// UIDeviceHardware.h
//
// Used to determine EXACT version of device software is running on.
#import <Foundation/Foundation.h>
@interface UIDeviceHardware : NSObject
- (NSString *) platform;
@daijo
daijo / UIWebView+Markdown.m
Created September 2, 2011 02:08
UIWebView+Markdown category.
//
// UIWebView+Markdown.m
// DropTextwiki
//
// Created by Daniel Hjort on 6/5/11.
// Copyright 2011 Patchwork Solutions AB. All rights reserved.
//
#import "UIWebView+Markdown.h"
#import "html.h"
@xslim
xslim / gist:851018
Created March 2, 2011 14:32
HTML to NSAttributedString
//
// NSAttributedString+fromHTML.m
// Berlingske
//
// Created by Taras Kalapun on 18.08.10.
// Copyright (c) 2010 Ciklum. All rights reserved.
//
#import "NSAttributedString+fromHTML.h"
@drdrang
drdrang / smarten.js
Created November 18, 2010 14:51
A very simple quote and dash smartener in JS. Used to make my tweets look nicer.
// Change straight quotes to curly and double hyphens to em-dashes.
function smarten(a) {
a = a.replace(/(^|[-\u2014/(\[{"\s])'/g, "$1\u2018"); // opening singles
a = a.replace(/'/g, "\u2019"); // closing singles & apostrophes
a = a.replace(/(^|[-\u2014/(\[{\u2018\s])"/g, "$1\u201c"); // opening doubles
a = a.replace(/"/g, "\u201d"); // closing doubles
a = a.replace(/--/g, "\u2014"); // em-dashes
return a
};