Skip to content

Instantly share code, notes, and snippets.

@alexburner
alexburner / gist:1331507
Created November 1, 2011 18:47
UNICODE
<html>
<head>
<title>UNICODE</title>
</head>
<body style="font-size:128px;">
<script>
var uni = '';
for ( var i = 0; i < 109385; i++ ) {
uni += '&#' + i + '; ';
}
@alexburner
alexburner / gist:1406189
Created November 29, 2011 19:55
Turning PST / PDT unixtime stamps into UTC date objects
// unixtime stamps from server are PT, need to make them UTC
var getAdjustedDate = function ( unixtime ) {
if ( !unixtime ) { return new Date(); }
var date, dst, offset;
// create date object
if ( typeof unixtime === 'number' ) {
date = new Date( unixtime * 1000 );
} else if ( typeof unixtime === 'string' ) {
unixtime = parseInt( unixtime, 10 );
date = new Date( unixtime * 1000 );
@alexburner
alexburner / app.js
Created December 13, 2011 22:43
Proof of Concept for Titanium implementation of Facebook/Path sidebar
Titanium.UI.setBackgroundColor('red');
// root
var rootWin = Ti.UI.createWindow({
title: 'Root Win',
backgroundColor: 'gray',
tabBarHidden: true,
navBarHidden: true
});
@alexburner
alexburner / gist:1500142
Created December 20, 2011 03:48
"this" and nested object methods
// exploring javascript's nefarious this
this.level = 0;
var test = {
level: 1,
method: function () {
console.log( this.level );
},
test: {
level: 2,
@alexburner
alexburner / app.js
Created December 31, 2011 22:34
testing weird titanium debug message
Ti.UI.setBackgroundColor( '#000' );
var clearBtn = Ti.UI.createButton({
title: 'Clear'
});
var addBtn = Ti.UI.createButton({
title: 'Add'
});
var win = Ti.UI.createWindow({
@alexburner
alexburner / app.js
Created January 12, 2012 22:50
Ti 1.8 appendRow issues BROKE VERSION
Ti.UI.setBackgroundColor( '#000' );
var openButton = Ti.UI.createButton( {
title: 'Open Win'
} );
var win = Ti.UI.createWindow( {
title: 'Root Win',
tabBarHidden: true,
rightNavButton: openButton
@alexburner
alexburner / app.js
Created January 12, 2012 22:53
Ti 1.8 appendRow issues WORKAROUND
Ti.UI.setBackgroundColor( '#000' );
var rows;
var openButton = Ti.UI.createButton( {
title: 'Open Win'
} );
var win = Ti.UI.createWindow( {
title: 'Root Win',
@alexburner
alexburner / gist:1784086
Created February 9, 2012 23:02
building a MySQL wrapper
class MySQLWrapper {
private $db = array(
'host' => null,
'name' => null,
'user' => null,
'pass' => null,
'pdo' => null
);
@alexburner
alexburner / gist:1784108
Created February 9, 2012 23:05
__get __set PHP magic
class Document {
private $_text;
public function __get( $name ) {
echo 'Document __get( ' . $name . ' )<br />';
$method = 'get' . $name;
if ( !method_exists( $this, $method ) ) { return null; }
return $this->$method();
}
@alexburner
alexburner / gist:1792187
Created February 10, 2012 19:49
PHP PDO helper class
class PDOwrapper {
//
// VARIABLES
private $db = array(
'host' => null,
'name' => null,
'user' => null,
'pass' => null,
'pdo' => null