Skip to content

Instantly share code, notes, and snippets.

Ian Tearle iantearle

Block or report user

Report or block iantearle

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@iantearle
iantearle / PLSqliteDatabase.h
Created Mar 5, 2012
Added radius distance function to Sqlite for Titanium Mobile
View PLSqliteDatabase.h
(FILE LOCATION iphone/Classes/PlausibleDatabase/PLSqliteDatabase.h)
/*
* Copyright (c) 2008 Plausible Labs Cooperative, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
@iantearle
iantearle / BootstrapResponsiveImages.js
Last active Jul 29, 2016
Bootstrap responsive images script to fetch the appropriate sized image based on the breakpoint and column width.
View BootstrapResponsiveImages.js
function findBootstrapEnvironment() {
var envs = ['xs', 'sm', 'md', 'lg'];
var $el = $('<div>');
$el.appendTo($('body'));
for (var i = envs.length - 1; i >= 0; i--) {
var env = envs[i];
$el.addClass('hidden-'+env);
@iantearle
iantearle / home.js
Created Dec 28, 2013
Alloy Tableview not popluating
View home.js
require('tiparse');
if(OS_ANDROID) {
var countly = require("ly.count");
countly.countInit();
} else if(OS_IOS) {
var RichText = require('com.obscure.RichText'),
uTils = require('uTils'),
countly = require('count.ly');
countly.start();
@iantearle
iantearle / PLSqliteDatabase.h
Created Oct 2, 2013
Extending the Plausible Database in Titanium to allow for SQLite distance function.
View PLSqliteDatabase.h
/*
* Copyright (c) 2008 Plausible Labs Cooperative, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
@iantearle
iantearle / recommends.row.js
Last active Dec 23, 2015
This for some reason throws : "'undefined' is not a function (evaluating 'data.push(recommendRow.getView())')";
View recommends.row.js
<Alloy>
<TableViewRow id="row" class="row" className="recommends">
<Label id="message">
</TableViewRow>
</Alloy>
@iantearle
iantearle / strings.xml
Created Sep 10, 2013
In order to start a string definition with a preceding space in Appcelerator i18n strings.xml file you need to escape the space. Bare in mind however you cannot add the javascript space character \s but simply \ will work.
View strings.xml
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string name="start_with_space">\ I have a space before me.</string>
</resources>
@iantearle
iantearle / alloy.js
Created Sep 9, 2013
BasicGeo where its not starting location services on iOS7 with v0.86
View alloy.js
var geo = require('bencoding.basicgeo');
Alloy.Globals.geoCurrent = geo.createCurrentGeolocation();
Alloy.Globals.geoCoder = geo.createGeocoder();
Alloy.Globals.helpers = geo.createHelpers();
@iantearle
iantearle / app.js
Created Jun 11, 2013
Testing out my Appcelerator Titanium app on iOS7 and I appear to have an issue with the remote back up flag.
View app.js
var doNotBackUp = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory);
doNotBackUp.remoteBackup = false;
@iantearle
iantearle / forecast.io.js
Created Apr 18, 2013
Forecast.io javascript library. Not currently working. Functions are not waiting for xhr data to complete. I have added a proxy script to help with cross domain policies. You should be able to run everything with these files. Please help me solve this. Many thanks. You can get your own API key from https://developer.forecast.io/register.
View forecast.io.js
/**
* Helper Class for forecast.io webservice
*/
function ForecastIO(api_key) {
API_ENDPOINT = 'https://api.forecast.io/forecast/';
/**
* Create a new instance
*
* @param String $api_key
View social.js
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));
You can’t perform that action at this time.