Skip to content

Instantly share code, notes, and snippets.

View romainbriche's full-sized avatar

Romain Briche romainbriche

View GitHub Profile
@romainbriche
romainbriche / TBXML+NSDictionary.h
Created February 27, 2012 09:07
Parse XML to NSDictionary using TBXML
#import "TBXML.h"
@interface TBXML (TBXML_NSDictionary)
+ (NSDictionary*)dictionaryWithXMLNode:(TBXMLElement*)element;
+ (NSDictionary*)dictionaryWithXMLData:(NSData*)data;
@end
@romainbriche
romainbriche / YouTubeHacks.m
Created April 5, 2012 07:07
How to hack the UIWebView YouTube-view to control play/pause and make it resizable
// Ok, this stuff is straight out of http://pspdfkit.com/
// Business-like it's probably not a good idea to share this
// but I just really love helping people and open sourcing stuff.
// Consider this snipped licensed under MIT, by Peter Steinberger.
// http://www.opensource.org/licenses/mit-license.php
// This uses all kinds of nasty private API, but I don't see another way.
// I tried to extract the mp4 URL in this project, https://github.com/steipete/PSYouTubeExtractor,
// but it required *lots* of hacks, is slow, and doesn't worked very well on iOS5.
// Turns out, Google _really_ doesn't want people access to their mp4 sources.
@romainbriche
romainbriche / IPInsetLabel.h
Created May 7, 2012 08:14
IPInsetLabel: a simple UILabel subclass that adds padding insets and auto-height-resizing
//
// IPInsetLabel.h
// Instapaper
//
// Created by Marco Arment on 7/23/11.
// Copyright 2011 Instapaper LLC, released to the public domain.
//
#import <UIKit/UIKit.h>
//
// NSObject+setValuesForKeysWithJSONDictionary.h
// SafeSetDemo
//
// Created by Tom Harrington on 12/29/11.
// Copyright (c) 2011 Atomic Bird, LLC. All rights reserved.
//
#import <Foundation/Foundation.h>
@romainbriche
romainbriche / AZModel.h
Created July 19, 2012 12:35
Thread-safe NSManagedObjectContext factory.
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
@interface AZModel : NSObject
+ (AZModel *)sharedModel;
- (__strong NSManagedObjectContext *)managedObjectContextForCurrentThread;
- (__autoreleasing NSManagedObjectContext *)newManagedObjectContextForCurrentThread;
@end
@romainbriche
romainbriche / TweetViaTweetbot.applescript
Created August 3, 2012 16:19
Copy title and URL of the current page in Safari to a new tweet in Tweetbot for Mac
-- TweetViaTweetbot.applescript
-- Copy title and URL in the front most window of Safari to Tweetbot with link
-- Author: Romain Briche
on copyTitleAndLinkToTweetbot(theTitle, theURL)
tell application "System Events"
set tweet to theTitle & " " & theURL & " via @"
set the clipboard to tweet as text
@romainbriche
romainbriche / LineaSDK.h
Created August 18, 2012 05:53
LineaSDK header file
/****h* Functions
FUNCTION
In order to use Linea in your program, several steps have to be performed:
- Include LineaSDK.h and libLineaSDK.a in your project.
- Go to Frameworks and add ExternalAccessory framework
- Edit your program plist file, add new element and select "Supported external accessory protocols" from the list, then add two items to it - \
com.datecs.linea.pro.msr and com.datecs.linea.pro.bar
*****/
/****h* Barcode Engine
FUNCTION
/*
Copyright 2011 Martin Hawksey
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
ACTION = build
AD_HOC_CODE_SIGNING_ALLOWED = NO
ALTERNATE_GROUP = staff
ALTERNATE_MODE = u+w,go-w,a+rX
ALTERNATE_OWNER = grantdavis
ALWAYS_SEARCH_USER_PATHS = NO
ALWAYS_USE_SEPARATE_HEADERMAPS = YES
APPLE_INTERNAL_DEVELOPER_DIR = /AppleInternal/Developer
APPLE_INTERNAL_DIR = /AppleInternal
APPLE_INTERNAL_DOCUMENTATION_DIR = /AppleInternal/Documentation
@romainbriche
romainbriche / EventEmitter.swift
Created October 24, 2017 11:12 — forked from brennanMKE/EventEmitter.swift
React Native Event Emitter for RCTEventEmitter in Objective-C and Swift
class EventEmitter
/// Shared Instance.
public static var sharedInstance = EventEmitter()
// ReactNativeEventEmitter is instantiated by React Native with the bridge.
private static var eventEmitter: ReactNativeEventEmitter!
private init() {}