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 / Existing File in Lib folder.js
Last active December 14, 2015 20:29
Alloy breaks TiFont by rewriting the javascript. See https://github.com/k0sukey/TiIconicFont/ for library
function SSSocial(options) {
switch (Ti.Platform.osname) {
case 'iphone':
case 'ipad':
this.fontfamily = 'SSSocialRegular';
break;
case 'android':
this.fontfamily = 'SSSocialRegular';
}
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 / forecast.io.js
Created April 18, 2013 10:41
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.
/**
* 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
@iantearle
iantearle / app.js
Created June 11, 2013 09:33
Testing out my Appcelerator Titanium app on iOS7 and I appear to have an issue with the remote back up flag.
var doNotBackUp = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory);
doNotBackUp.remoteBackup = false;
@iantearle
iantearle / alloy.js
Created September 9, 2013 15:02
BasicGeo where its not starting location services on iOS7 with v0.86
var geo = require('bencoding.basicgeo');
Alloy.Globals.geoCurrent = geo.createCurrentGeolocation();
Alloy.Globals.geoCoder = geo.createGeocoder();
Alloy.Globals.helpers = geo.createHelpers();
@iantearle
iantearle / strings.xml
Created September 10, 2013 10:43
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.
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string name="start_with_space">\ I have a space before me.</string>
</resources>
@iantearle
iantearle / recommends.row.js
Last active December 23, 2015 11:39
This for some reason throws : "'undefined' is not a function (evaluating 'data.push(recommendRow.getView())')";
<Alloy>
<TableViewRow id="row" class="row" className="recommends">
<Label id="message">
</TableViewRow>
</Alloy>
@iantearle
iantearle / PLSqliteDatabase.h
Created October 2, 2013 09:54
Extending the Plausible Database in Titanium to allow for SQLite distance function.
/*
* 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 / home.js
Created December 28, 2013 09:38
Alloy Tableview not popluating
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 / 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">