This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isiOSVersionOrHigher(major_version) | |
{ | |
if (Titanium.Platform.name == 'iPhone OS') | |
{ | |
var version = Titanium.Platform.version.split("."); | |
var major = parseInt(version[0],10); | |
// can only test this support on a 3.2+ device | |
if (major >= major_version) | |
{ | |
return true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Various useful functions. | |
function dateformat (format, timestamp) { | |
var that = this, | |
jsdate, f, formatChr = /\\?([a-z])/gi, | |
formatChrCb, | |
// Keep this here (works, but for code commented-out | |
// below for file size reasons) | |
//, tal= [], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isBSTinEffect(){ | |
var d = new Date(); | |
var lSoM; | |
// Loop over the 31 days of March for the current year | |
for(var i=31; i>0; i--){ | |
var tmp = new Date(d.getFullYear(), 2, i); | |
// If it's Sunday | |
if(tmp.getDay() == 0){ | |
// last Sunday of March | |
lSoM = tmp; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
// To create an App.net stream ... | |
$access_token = "YOUR_DEVELOPER_APP_ACCESS_TOKEN"; | |
// to get an App Access token, see here : http://developers.app.net/docs/authentication/flows/app-access-token/ | |
/* | |
$ch = curl_init(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
// App.net Avatar uploader | |
// @Kosso | |
$access_token = 'AQAAAAAAAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'; | |
$file_path = 'some_hilarious.gif'; | |
$mime_type = 'image/gif'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
via http://stackoverflow.com/questions/4998908/convert-data-uri-to-file-then-append-to-formdata/5100158 | |
via http://www.smartjava.org/content/face-detection-using-html5-javascript-webrtc-websockets-jetty-and-javacvopencv | |
**/ | |
function dataURItoBlob(dataURI) { | |
var binary = atob(dataURI.split(',')[1]); | |
var array = []; | |
for(var i = 0; i < binary.length; i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.ajax({ | |
beforeSend: function (req){ | |
req.setRequestHeader("Authorization: Bearer", access_token); | |
req.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); | |
}, | |
type: "POST", | |
url: "https://alpha.app.net/oauth/access_token", | |
dataType:"json", | |
data:"grant_type=delegate&delegate_client_id=THECrAzYAppLIcATIOnWhICHaPAiNintHEaSS123", | |
success:function(data){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)clearWebViewCookies:(NSMutableArray*)cleardomain | |
{ | |
NSLog(@"[INFO] called webView clearWebViewCache to clear : %@", [cleardomain objectAtIndex:0]); | |
for(NSHTTPCookie *cookie in [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies]) { | |
//NSLog(@"[INFO] cookie for : %@",[cookie domain]); | |
if([[cookie domain] isEqualToString:[cleardomain objectAtIndex:0]]) { | |
//NSLog(@"[INFO] deleting cookie for : %@",[cookie domain]); | |
[[NSHTTPCookieStorage sharedHTTPCookieStorage] deleteCookie:cookie]; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(void)setContentInsets_:(id)value withObject:(id)props | |
{ | |
UIEdgeInsets insets = [TiUtils contentInsets:value]; | |
BOOL animated = [TiUtils boolValue:@"animated" properties:props def:NO]; | |
void (^setInset)(void) = ^{ | |
[tableview setContentInset:insets]; | |
}; | |
if (animated) { | |
double duration = [TiUtils doubleValue:@"duration" properties:props def:300]/1000; | |
[UIView animateWithDuration:duration animations:setInset completion:^(BOOL finished){ |