Skip to content

Instantly share code, notes, and snippets.

View iantearle's full-sized avatar
💭
I may be slow to respond.

Ian Tearle iantearle

💭
I may be slow to respond.
View GitHub Profile
@stevenou
stevenou / GeolocationModule.mm
Created February 14, 2012 21:15
Geofencing in Titanium
// this file located in /Library/Application Support/Titanium/mobilesdk/osx/{version_number}
// add the following methods to GeolocationModule.mm
- (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region
{
NSDictionary *event = [NSDictionary dictionaryWithObjectsAndKeys:NUMBOOL(YES),@"success",[NSDictionary dictionaryWithObjectsAndKeys:NUMDOUBLE(region.center.latitude),@"lat",NUMDOUBLE(region.center.longitude),@"lng",NUMDOUBLE(region.radius),@"radius",region.identifier,@"identifier",nil],@"region",nil];
if ([self _hasListeners:@"enteredRegion"])
{
[self fireEvent:@"enteredRegion" withObject:event];
@aaronksaunders
aaronksaunders / index.html
Created March 26, 2012 17:27
Appcelerator Cloud Services with Backbonejs & Twitter Bootstrap
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link href="bootstrap/css/bootstrap.css" rel="stylesheet">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>New Appcelerator Cloud Services Project</title>
<script type="text/javascript">
function onBodyLoad() {
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@jafstar
jafstar / upload.js
Created April 18, 2012 15:02
Appcelerator + Cloudinary + Image Upload
//CREATE WINDOW
var win = Ti.UI.createWindow({
title: 'Upload',
backgroundColor: '#FFF',
fullscreen: true,
navBarHidden: true
});
//PHOTO VIEW CONTAINER
@molinto
molinto / fourSquareAPI.js
Created July 24, 2012 11:05
Titanium FourSquare API Integration
/*
Author: James Shrager (@jshrager)
Intended use: Appcelerator Titanium
Usage: http://www.LearningTitanium.com (@learningTi)
*/
var client_id = "YOUR_CLIENT_ID";
var client_secret = "YOUR_CLIENT_SECRET";
var redirectUri = 'http://YOUR_URL/foursquareCallback.php';
var ui = require('ui/ui');
@marcedwards
marcedwards / high-dpi-media.css
Last active November 19, 2023 12:56
A CSS media query that captures almost all high DPI aware devices.
/* ---------------------------------------------------------- */
/* */
/* A media query that captures: */
/* */
/* - Retina iOS devices */
/* - Retina Macs running Safari */
/* - High DPI Windows PCs running IE 8 and above */
/* - Low DPI Windows PCs running IE, zoomed in */
/* - Low DPI Windows PCs and Macs running Firefox, zoomed in */
/* - Android hdpi devices and above */
@raulriera
raulriera / DialogWindow.js
Created September 9, 2012 11:08
CustomAlertDialog commonJS module for Titanium Appcelerator. Similar to the "Tweetbot" (but will need more makeup of course) where the information is displayed below the title bar instead of an intrusive popup
DialogWindow = function(message, type){
// Default params
var message = message || "How about you add some message to this? :)";
var type = type || "error";
var window = Titanium.UI.createWindow({
width: 320,
height: 44,
top: 44,
@rampicos
rampicos / social.js
Last active January 10, 2019 10:10
Social.js is the Appcelerator Titanium's Alloy Widget at first it is used to connect with Twitter only, though twitter and linkedin uses OAuth for its authentication I made some changes on Social.js for multi-purpose to connect Twitter and LinkedIn
function hex_sha1(s) {
return binb2hex(core_sha1(str2binb(s), s.length * chrsz));
}
function b64_sha1(s) {
return binb2b64(core_sha1(str2binb(s), s.length * chrsz));
}
function str_sha1(s) {
return binb2str(core_sha1(str2binb(s), s.length * chrsz));
@stephenfeather
stephenfeather / parse.js
Last active March 1, 2022 12:06
Quick library for using the Parse REST API within Appcelerator's Titanium. Building it out as I need different pieces of the API.
// Copyright Stephen Feather and other contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
@daneden
daneden / webhook.php
Last active December 12, 2015 07:18
Here’s the (somewhat stripped down/censored) script I’m using to deploy my sites. My old method had a script *per repo* inside the directory and added to `.gitignore`. Not a very maintainable or elegant solution. This way, I just hit an address with a query string. Obviously, the repo needs to be owned by the user that the web server is running …
<?php
/*
Usage: http://example.com/webhook.php?repo=repo-name
Obviously, for security, a different file name (or at least a different query string variable name) should be used.
*/
$path = null;