Skip to content

Instantly share code, notes, and snippets.

// at the top of the file
@interface TiApp()
- (void)checkBackgroundServices;
- (void)appBoot;
@property (atomic) NSMutableDictionary *responsesData; //here we are holding the responsesData, using their taskIdentifiers as keys
@end
// Here I initialise the property
- (void)appBoot
{
kjsBridge = [[KrollBridge alloc] initWithHost:self];
@rlustemberg
rlustemberg / ti.dynamiclib.js
Last active January 24, 2017 18:32
Support embedded binaries (aka dynamic libraries) in Titanium modules and Hyperloop
/**
* Ti.DynamicLib
* @abstract Support embedded binaries (aka dynamic libraries) in Titanium modules and Hyperloop.
* @version 1.0.0
*
* Install:
* 1) Search and replace '../../src/<YourFramework>.framework' with your framework location.
* 2) Search and replace '<StripFrameworkScriptPath>' with the path to your strip-frameworks.sh file
The path is relative to the `build/iphone` directory.
* 3a) For classic modules:
@rlustemberg
rlustemberg / ti.dynamiclib.js
Created January 21, 2017 04:05 — forked from hansemannn/ti.dynamiclib.js
Support embedded binaries (aka dynamic libraries) in Titanium modules and Hyperloop
/**
* Ti.DynamicLib
* @abstract Support embedded binaries (aka dynamic libraries) in Titanium modules and Hyperloop.
* @version 1.0.0
*
* Install:
* 1) Search and replace '../../src/<YourFramework>.framework' with your framework location.
The path is relative to the `build/iphone` directory.
* 2a) For classic modules:
* - Add 'LD_RUNPATH_SEARCH_PATHS=$(inherited) "@executable_path/Frameworks" $(FRAMEWORK_SEARCH_PATHS)'
@rlustemberg
rlustemberg / gist:4965f399014ec07cd742df4ceae81020
Created September 12, 2016 16:27 — forked from akisute/gist:1141953
Create an animated gif file from images in iOS
#import <UIKit/UIKit.h>
#import <ImageIO/ImageIO.h>
#import <MobileCoreServices/MobileCoreServices.h>
- (void)exportAnimatedGif
{
UIImage *shacho = [UIImage imageNamed:@"shacho.png"];
UIImage *bucho = [UIImage imageNamed:@"bucho.jpeg"];
NSString *path = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:@"animated.gif"];
@rlustemberg
rlustemberg / xregexp-unicode-codepoints.js
Created January 28, 2016 16:05 — forked from slevithan/xregexp-unicode-codepoints.js
Full 21-bit Unicode code point matching in XRegExp with \u{10FFFF}
// Allow syntax extensions
XRegExp.install("extensibility");
/* Adds Unicode code point syntax to XRegExp: \u{n..}
* `n..` is any 1-6 digit hexadecimal number from 0-10FFFF. Comes from ES6 proposals. Code points
* above U+FFFF are converted to surrogate pairs, so e.g. `\u{20B20}` is simply an alternate syntax
* for `\uD842\uDF20`. This can lead to broken behavior if you follow a `\u{n..}` token that
* references a code point above U+FFFF with a quantifier, or if you use the same in a character
* class. Using `\u{n..}` with code points above U+FFFF is therefore not recommended, unless you
* know exactly what you're doing. XRegExp's handling follows ES6 proposals for `\u{n..}`, since
@rlustemberg
rlustemberg / app.js
Last active September 10, 2015 16:52 — forked from FokkeZB/app.js
Embedding a YouTube video in Titanium
var win = Ti.UI.createWindow();
var webView = Ti.UI.createWebView({
url: 'http://www.youtube.com/embed/' + myVideoID + '?autoplay=1&autohide=1&cc_load_policy=0&color=white&controls=0&fs=0&iv_load_policy=3&modestbranding=1&rel=0&showinfo=0',
enableZoomControls: false,
scalesPageToFit: false,
scrollsToTop: false,
showScrollbars: false
});
@rlustemberg
rlustemberg / TiBounty.js
Created February 1, 2011 19:45
there is a bug but I am in hurry
var TiBounty={};
TiBounty.UI={};
TiBounty.renderList=function(tableView,atLarge){
var rows =TiBounty.model.getFugitives(atLarge);
var data=[];
while(rows.isValidRow()){
var row = Ti.UI.createTableViewRow({title:rows.fieldByName('name'),sId:rows.fieldByName('id'), hasDetail:true});
var TiBounty={};
TiBounty.UI={};
TiBounty.renderList=function(tableview){
var rows =TiBounty.model.getFugitives();
var data=[];
var image;
var legend;
while(rows.isValidRow()){
var row = Ti.UI.createTableViewRow({title:rows.fieldByName('name'),sId:rows.fieldByName('id'), hasDetail:true});