Skip to content

Instantly share code, notes, and snippets.

View rblalock's full-sized avatar
🚀

Rick Blalock rblalock

🚀
View GitHub Profile
@rblalock
rblalock / bug.m
Created December 10, 2013 15:24
The bug in the ASIHTTP lib Ti SDK uses - https://jira.appcelerator.org/browse/TIMOB-14954
// The bug
if ([requestMethod isEqualToString:@"GET"] || [requestMethod isEqualToString:@"DELETE"] || [requestMethod isEqualToString:@"HEAD"]) {
[self setRequestMethod:@"POST"];
}
// Why not just
if ([requestMethod isEqualToString:@"GET"]) {
[self setRequestMethod:@"POST"];
}
var attr = Ti.UI.iOS.createAttributedString({
text: text,
attributes: [
// Underlines text
{
type: Ti.UI.iOS.ATTRIBUTE_UNDERLINES_TYLE,
value: Ti.UI.iOS.ATTRIBUTE_UNDERLINE_STYLE_SINGLE | Ti.UI.iOS.ATTRIBUTE_UNDERLINE_PATTERN_DASH_DOT_DOT,
range: [0, text.length]
},
var win = Ti.UI.createWindow({
backgroundColor: 'white'
});
var pages = [];
// Helper to generate a sample form
function buildPage() {
var wrapper = Ti.UI.createView({
layout: "vertical"
static BOOL isLoaded;
/**
Singleton, shared instance
**/
+ (id)sharedInstance
{
__strong static id _sharedObject = nil;
if(isLoaded == NO) {
{
"backgroundImage": "sunny",
"location": "Hertfordshire, United Kingdom",
"current": {
"tempC": 22,
"tempF": 72,
"icon": "sunny",
"observationTime": "02:12 PM",
"description": "Sunny",
"shortDescription": "Sunny",
/**
* Generates the column data
*/
$.generateColumn = function() {
var numbers = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0];
var labels = [];
numbers.forEach(function(_number) {
labels.push(
Ti.UI.createLabel({
@rblalock
rblalock / first.js
Last active December 19, 2015 17:09
Weird bug in Android web view around querySelectorALL(); - http://beautyindesign.com/blog/stumped-android-webview-queryselectorall/
// Selecting based on total document
var selectedUnits = document.querySelectorAll("[data-selected='selected']");
Ti.App.addEventListener("playSound", function(_event) {
var soundPlayer = Ti.Media.createSound({
url: "/game/" + _event.soundFile
});
soundPlayer.play();
soundPlayer.addEventListener("complete", function() {
if(OS_ANDROID) {
soundPlayer.release();
}
/**
* Global singleton
*/
var APP = {
/**
* This sets up global events, persistant things
* throughout the app, etc. Only should be called
* when the app is booted.
*/
var RedLaser = require('ti.redlaser');
var win = Ti.UI.createWindow({
backgroundColor: "#eee"
});
var startScanningBtn = Ti.UI.createButton({
width: "50%",
height: 50,
title: "Start Scanning"