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">
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));
@iantearle
iantearle / GeolocationModule.mm
Created November 26, 2012 12:11 — 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];
@iantearle
iantearle / hack.sh
Created November 15, 2012 09:32 — forked from erikh/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/4077645/hack.sh | sh
#
@iantearle
iantearle / RateMe.js
Created November 1, 2012 21:28 — forked from psyked/RateMe.js
"Rate my app in Appcelerator Titanium Mobile" as a commonJS module.
function RateMe(ios_url, goog_url, usecount) {
if(!Ti.App.Properties.hasProperty('RemindToRate')) {
Ti.App.Properties.setString('RemindToRate', 0);
}
var remindCountAsInt = parseInt(Ti.App.Properties.getString('RemindToRate'), 10);
var newRemindCount = remindCountAsInt += 1;
if(remindCountAsInt === -1) {
// the user has either rated the app already, or has opted to never be
// reminded again.
@iantearle
iantearle / 00-readme.txt
Created May 8, 2012 11:00 — forked from bob-sims/00-readme.txt
CommonJS module to pull XML response from from (undocumented) Google Weather API, for use with Titanium Mobile
// console dump of sample returned object
I/TiAPI ( 244): (kroll$4: app://app.js) [797,3312] Object
I/TiAPI ( 244): {
I/TiAPI ( 244): weatherData => Object
I/TiAPI ( 244): {
I/TiAPI ( 244): forecastInfo => Object
I/TiAPI ( 244): {
I/TiAPI ( 244): city => 'Bydgoszcz, Kuyavian-Pomeranian Voivodeship',
@iantearle
iantearle / index.html
Created April 2, 2012 22:32 — forked from aaronksaunders/index.html
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() {
@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];
@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 / 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'
});