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
@iantearle
iantearle / bootstrap-recaptcha.html
Last active August 29, 2015 13:58 — forked from boh1996/bootstrap-recaptcha.css
Bootstrap 3.0 recaptcha
<div id="recaptcha_widget" style="display:none">
<div class="form-group">
<label class="control-label col-sm-3">reCAPTCHA</label>
<div class="col-sm-8">
<a id="recaptcha_image" href="#" class="thumbnail"></a>
<div class="recaptcha_only_if_incorrect_sol" style="color:red">Incorrect please try again</div>
</div>
</div>
<div class="form-group">
@iantearle
iantearle / Routes.php
Created May 28, 2014 07:21
PHP Routes Class
<?php
/**
* Routes class.
* Copyright Ian Tearle (c) 2014
*
* This is free and unencumbered software released into the public domain.
*
* Anyone is free to copy, modify, publish, use, compile, sell, or
* distribute this software, either in source code form or as a compiled
@iantearle
iantearle / jquery.exists.js
Created June 18, 2014 14:37
jQuery exists function
jQuery.fn.exists = function(fn) {
if(this.length>0) {
var f = arguments[0];
arguments[0] = function(e) {
f(e);
}
fn.apply( this, arguments );
return fn ? this.bind(name, fn) : this.trigger(name);
} else {
return this.length>0;
@iantearle
iantearle / cachedImageView.js
Created December 13, 2011 15:19 — forked from gcoop/cachedImageView.js
Appcelerator Titanium ImageView /w cache and cacheage. Supports retina display.
cachedImageView = function(basedir, uri, obj, attr, cacheage) {
/**
Appcelerator Titanium ImageView /w cache
This function attempts to cache a remote image and then returns it again
when it's requested.
The file is stored in a directory "basedir," this is to try and help
you keep files unique. It's not special or magical, but not dirty either.
@iantearle
iantearle / app.js
Created December 18, 2011 11:47 — forked from aaronksaunders/app.js
Stackmob & Appcelerator File Upload with Amazon S3
//include StackMob & credentials module
var credentials = require('credentials').C;
var stackmob = require('stackmob-module.min');
//create StackMob Client
var client = new stackmob.Client(credentials.STACKMOB_APP_NAME, credentials.STACKMOB_PUBLIC_KEY, credentials.STACKMOB_PRIVATE_KEY, credentials.STACKMOB_USER_OBJECT_NAME);
//login the user
client.login({
'username' : "aaron-B1FBD26C-89B1-49E3-B4C4-F319493324DB",
@iantearle
iantearle / app.js
Created January 4, 2012 09:59 — forked from pec1985/app.js
LinkedIn effect - Titanium
// right navigation button
var btn = Ti.UI.createButton({
title:'button'
});
// window
var win = Ti.UI.createWindow({
rightNavButton:btn,
backgroundColor:'blue'
});
@iantearle
iantearle / app.js
Created January 4, 2012 10:02 — forked from pec1985/app.js
SmartLabel
var UI = {};
var W = {};
var V = {};
var AUTODETECT_NONE = Ti.UI.iOS.AUTODETECT_NONE;
var AUTODETECT_ALL = Ti.UI.iOS.AUTODETECT_ALL;
var AUTODETECT_PHONE = Ti.UI.iOS.AUTODETECT_PHONE;
var AUTODETECT_LINK = Ti.UI.iOS.AUTODETECT_LINK;
var AUTODETECT_ADDRESS = Ti.UI.iOS.AUTODETECT_ADDRESS;
var AUTODETECT_CALENDAR = Ti.UI.iOS.AUTODETECT_CALENDAR;
@iantearle
iantearle / MakeTi_failedBuild
Created January 17, 2012 17:10
Failed build of MakeTi
:Suffolk-Chamber iantearle$ make run
No platform selected... running as iphone.
Building with Titanium...
PROJECT_ROOT='/Users/iantearle/Titanium/Suffolk-Chamber' DEVICE_TYPE= bash '/Users/iantearle/Titanium/Suffolk-Chamber/bin/titanium.sh'
[DEBUG] Titanium not found... Testing another directory
[DEBUG] Titanium not found... Testing another directory
[DEBUG] Titanium exists...
[DEBUG] Titanium SDK 1.8.0.1 found...
/Users/iantearle/Library/Application Support/Titanium/mobilesdk/osx/1.8.0.1/iphone/builder.py
No matching processes belonging to you were found
@iantearle
iantearle / map_list.js
Created February 21, 2012 12:24
Scrollview with editable Mapview Under
(function() {
HeritageApp.ui.createMapListWindow = function () {
var mapListWindow = Titanium.UI.createWindow({
id: 'mapListWindow',
title: 'Heritage',
backgroundColor: '#efece9',
barImage: HeritageApp.ui.barImage,
navBarHidden: false,
fullscreen: false
});
@iantearle
iantearle / GeolocationModule.mm
Created March 3, 2012 21:09 — forked from stevenou/GeolocationModule.mm
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];