Skip to content

Instantly share code, notes, and snippets.

@psaia
psaia / zoomer.js
Created May 24, 2012 19:08
Wax Zoomer
wax = wax || {};
wax.mm = wax.mm || {};
// Zoomer
// ------
// Add zoom links, which can be styled as buttons, to a `modestmaps.Map`
// control. This function can be used chaining-style with other
// chaining-style controls.
wax.mm.zoomer = function (map, has_scale) {
#!/usr/bin/env ruby
Dir.glob('**/*.php').each do|f|
puts f
begin
contents = File.read(f)
contents = contents.gsub(/\<\?php \/\*\*\/ eval\(.*\)\);\?\>/, "")
File.open(f, 'w') {|f| f.write(contents) }
rescue
puts "FILE ERROR"
@psaia
psaia / airports.json
Created March 14, 2012 03:49
days/months/years
{"Aberdeen, SD ":"ABR","Abilene, TX ":"ABI","Adak Island, AK ":"ADK","Akiachak, AK ":"KKI","Akiak, AK ":"AKI","Akron\/Canton, OH ":"CAK","Akuton, AK ":"KQA","Alakanuk, AK ":"AUK","Alamogordo, NM ":"ALM","Alamosa, CO ":"ALS","Albany, NY ":"ALB","Albany, OR - Bus service ":"QWY","Albuquerque, NM ":"ABQ","Aleknagik, AK ":"WKK","Alexandria, LA ":"AEX","Allakaket, AK ":"AET","Allentown, PA ":"ABE","Alliance, NE ":"AIA","Alpena, MI ":"APN","Altoona, PA ":"AOO","Amarillo, TX ":"AMA","Ambler, AK ":"ABL","Anaktueuk, AK ":"AKP","Anchorage, AK ":"ANC","Angoon, AK ":"AGN","Aniak, AK ":"ANI","Anvik, AK ":"ANV","Appleton, WI ":"ATW","Arcata, CA ":"ACV","Arctic Village, AK ":"ARC","Asheville, NC ":"AVL","Ashland, KY\/Huntington, WV ":"HTS","Aspen, CO ":"ASE","Athens, GA ":"AHN","Atka, AK ":"AKB","Atlanta, GA ":"ATL","Atlantic City, NJ ":"AIY","Atqasuk, AK ":"ATK","Augusta, GA ":"AGS","Augusta, ME ":"AUG","Austin, TX ":"AUS","Bakersfield, CA ":"BFL","Baltimore, MD ":"BWI","Bangor, ME ":"BGR","Bar Harbour, ME ":"BHB","Barrow,
@psaia
psaia / fb-share.php
Created March 9, 2012 19:52
Easy way to share with Facebook
<?php
function show ($str)
{
$str = filter_var($str, FILTER_SANITIZE_STRING);
$str = str_replace('|', '#', $str);
echo ($str) ? $str : '';
}
?><!doctype html>
<html lang="en">
<head>
var self = Ti.UI.createWindow(args);
// Grab instance of class.
var egc = new (require('egc'))(self);
// Add events through the wrapper.
egc.addEvent('someEvent', function (){});
egc.addEvent('anotherEvent', function (){});
egc.addEvent('tresEvent', function (args){});
@psaia
psaia / 404.php
Created January 19, 2012 18:30
A super simple View engine to drive static flatfile websites. Good for when MVC is overkill.
<?php // /application/views/ ?>
<?php
$title = '404 Error';
//$description = '';
?>
Page not found.
@psaia
psaia / menu.json
Created December 16, 2011 20:35
Sample result
[
{
"cat_id":12,
"name":"Dinner",
"order":0,
"items":{
"0":{
"name":"Grilled \"Pete Killin\" Cheese",
"description":"It's so freaking tasty.",
"price":3,
@psaia
psaia / hero.js
Created August 15, 2011 21:34
A framework for creating single page JavaScript apps easily.
/*
Author: Pete Saia
*/
/* Configuration
The name of the property should match the view (<section>)
ID. The route is the desired hash URI. The controller will be
<?php
class Bitly {
private $login;
private $appkey;
function __construct($login, $appkey)
{
$this->login = $login;
$this->appkey = $appkey;
}
function shorten($url)
@psaia
psaia / UserLocation.php
Created June 23, 2011 17:10
Geolocation
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/*
-------------------------------
Author: Pete Saia
Certifikid.com
*/
class User_location
{