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 / register.js
Created April 1, 2012 07:09
Appcelerator Register with custom fields
var sex = (male == 1) ? 'male' : 'female';
var data = {
email: email.value,
first_name: global.user_names[0],
last_name: global.user_names[1],
password: password.value,
password_confirmation: password.value,
custom_fields: '{ "dob": "'+ dob.value +'", "sex": "'+ sex +'" }' // REMOVE THIS LINE IT ALL WORKS... HAVE HAD MULTIPLE PEDRMEATATIONS, SO THIS WAY MAY NOT BE THE ONLY CAUSE OF THIS NOT WORKING, JUST THE LAST ONE I TRIED.
};
sdk.sendRequest('users/create.json', 'POST', data, false, callback);
@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 / cocoafish.html
Created April 3, 2012 09:25
Cocoafish login then create a place...
<html>
<head xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<title>Cocoafish test</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<script type="text/javascript" src="http://sdk.cocoafish.com/js/cocoafish-1.1.min.js"></script>
<script type="text/javascript">
jQuery(document).ready(function() {
var sdk = new Cocoafish('API'); // app key
var data = {
@iantearle
iantearle / gist:2406021
Created April 17, 2012 13:40
Titanium Path Centered
// Path menu for Titanium
// Tony Lukasavage - @tonylukasavage
//
// Notes:
// - Transforms must be declared outside the animation to
// work on Android. (http://jira.appcelerator.org/browse/TIMOB-5796)
// There MUST be more than 1 icon or the math breaks
var DEFAULTS = {
ICON_IMAGE: '/images/star.png',
@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 / gist:2958439
Created June 20, 2012 06:36
iPad UA Module replication of bug
// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#000');
var UrbanAirship = require('ti.urbanairship');
// create tab group
var tabGroup = Titanium.UI.createTabGroup();
UrbanAirship.options = {
APP_STORE_OR_AD_HOC_BUILD: false,
PRODUCTION_APP_KEY: 'xxxx',
PRODUCTION_APP_SECRET: 'xxxx',
@iantearle
iantearle / gist:3055657
Created July 5, 2012 18:51
JSON stringify no work...
// The following result from Parse.com query is great, has createdAt which is exactly what I want. Only thing is I want to cache this result on the device. If I JSON.stringify it, all I get is the attributes.
(
{
"_dirty" = {
};
"_escapedAttributes" = {
};
"_handleSetOp" = "<KrollCallback: 0xff4b850>";
"_hashedJSON" = {
};
@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 / Login.js
Created November 5, 2012 12:46
Trying to retrieve the values from username and password in Login.
//FirstView Component Constructor
function Login() {
var Title = require('ui/common/Title'),
Logo = require('ui/common/Logo');
UserPassword = require('ui/common/UserPassword');
//create object instance, a parasitic subclass of Observable
var self = Ti.UI.createView({
width: Ti.Platform.displayCaps.platformWidth - 50,
left: 50
@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
#