Skip to content

Instantly share code, notes, and snippets.

View romainbriche's full-sized avatar

Romain Briche romainbriche

  • San Francisco, California
View GitHub Profile
@JaviSoto
JaviSoto / gist:5504598
Created May 2, 2013 19:12
iOS Debug display image function
/**
* @discussion takes the passed image parameter and displays a view controller modally that shwos the image
* You can call it from the debugger like this:
* expr JSDebugDisplayImage(image)
* @note you can dismiss the view controller simply by tapping on it
*/
extern void JSDebugDisplayImage(UIImage *image);
@jspahrsummers
jspahrsummers / gist:5490301
Last active December 16, 2015 20:09
Demonstrating the semantics of __weak objects in Objective-C. See http://clang.llvm.org/docs/AutomaticReferenceCounting.html#semantics for more information.
// The weak pointer is read, and retained until the message send completes its synchronous work.
[weakValue doAThing];
@n-b
n-b / NBResponderChainUtilities.h
Last active August 3, 2021 10:08
Chain Responder Debugging Methods
//
// NBResponderChainUtilities.h
//
// Created by Nicolas @ bou.io on 19/04/13.
//
#import <UIKit/UIKit.h>
@interface UIView (NBResponderChainUtilities)
- (UIView*) nb_firstResponder; // Recurse into subviews to find one that responds YES to -isFirstResponder
@olegam
olegam / gist:5419001
Last active December 16, 2015 10:19
This is a podspec pointing to the HEAD of ReactiveCocoa. To use it add the following line to your Podfile: pod 'ReactiveCocoa', :podspec => 'https://gist.github.com/olegam/5419001/raw/93e2e2e7c3c35fc10e6ca660bfd18309b666af36/gistfile1.rb'
Pod::Spec.new do |s|
s.name = "ReactiveCocoa"
s.version = "1.x-head"
s.summary = "A framework for composing and transforming sequences of values."
s.homepage = "https://github.com/blog/1107-reactivecocoa-is-now-open-source"
s.author = { "Josh Abernathy" => "[email protected]" }
s.source = { :git => "https://github.com/ReactiveCocoa/ReactiveCocoa.git" }
s.license = 'Simplified BSD License'
s.description = "ReactiveCocoa offers:\n" \
"1. The ability to compose operations on future data.\n" \
@JaviSoto
JaviSoto / watchface01.c
Created April 17, 2013 16:58
My first Pebble Watchface
#include "pebble_os.h"
#include "pebble_app.h"
#include "pebble_fonts.h"
#define MY_UUID { 0x57, 0xFF, 0x75, 0x31, 0x72, 0x97, 0x46, 0x0A, 0x86, 0x02, 0x6F, 0x6F, 0x79, 0xEA, 0x4E, 0xE4 }
PBL_APP_INFO(MY_UUID,
"Watchface", "Javier Soto",
1, 0, /* App version */
DEFAULT_MENU_ICON,
@evadne
evadne / gist:5385806
Created April 15, 2013 04:52
Loading images from Data URIs
// Image is from http://dopiaza.org/tools/datauri/examples/index.php
#import "DIAppDelegate.h"
@implementation DIAppDelegate
- (BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.backgroundColor = [UIColor whiteColor];
@rgm
rgm / stamp-icon.rb
Last active September 11, 2023 12:40
Add the current version and build number on your iOS app icon
#!/usr/bin/env ruby
# Requires ImageMagick: `brew install imagemagick`
# Requires version.sh from https://gist.github.com/osteslag/1089407
#
# Set RGM_STAMP_VERSION_ON_ICONS=1 in your build settings to enable/disable
# stamping on Debug/Relase configurations.
#
# Make base unstamped versions Icon.base.png, &c. in the source tree. The
# script will make stamped versions Icon.png, &c. It relies on Xcode to copy
@indragiek
indragiek / gist:5372841
Created April 12, 2013 15:23
Sanitizing URL strings
NSString *sanitizedString = [URLString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSURL *URL = [NSURL URLWithString:sanitizedString];
@skabber
skabber / hockeyCrashes.py
Created April 10, 2013 23:22
A Python script to graph all your production app crashes in Status Board
#!/usr/bin/env python
import requests
import json
import StringIO
import datetime
hockeyToken = 'getyourowndamnkey'
appsEndpoint = 'https://rink.hockeyapp.net/api/2/apps'
crashesEndpoint = 'https://rink.hockeyapp.net/api/2/apps/%s/crashes/histogram?api_token=%s&format=json&start_date=%s&end_date=%s'
@autresphere
autresphere / gist:5300529
Created April 3, 2013 11:49
How to handle view controller transitions with an animated: flag (http://khanlou.com/2013/03/animations-with-an-animated-flag/). Another solution much simpler.
- (void) pushViewController:(UIViewController *)viewController animated:(BOOL)animated {
newViewController.view.frame = //original frame
[self addChildViewController:newViewController];
[self transitionFromViewController:oldViewController
toViewController:newViewController
duration:(animated?0.35f:0)
options:0
animations:^{