Skip to content

Instantly share code, notes, and snippets.

View jakemcgraw's full-sized avatar
📈
start up cash in sell out bro down

Jake McGraw jakemcgraw

📈
start up cash in sell out bro down
View GitHub Profile
var pollInterval = 1000;
var someFunc = function(){
/* do some shit */
window.setTimeout(someFunc, pollInterval);
};
someFunc();
<?php
// More info at http://framework.zend.com/manual/en/zend.db.adapter.html
// Assumes Zend dir is in your include path
require_once 'Zend/Db.php';
$db = Zend_Db::factory('Pdo_Mysql', array(
'host' => '127.0.0.1',
'username' => 'webuser',
//...
$("a.edit").live("click", function(){
$(this).prev(".cmrl").msgeditor({showPreview:true, buttons:{
Accept: function(hash) {
// Update preview, show
$(hash.textarea).next(".preview").html(hash.preview).show();
// Update CMRL, close editor
<?php
$xml = <<<EOD
<?xml version="1.0" encoding="UTF-8"?>
<cmrl xmlns:dotgo="http://dotgo.com/cmrl/1.0" account="jddbb-ztc2l-f1tb7-2c8st">
<match pattern="">
<message><content>DOTGO.COM<br />
Welcome to DOTGO!<br />
<br />
Reply:<br />
window.PHONO = null;
$.phono({
apiKey: "XXXXX",
onReady: function(){
PHONO = this;
}
});
$(function(){
@jakemcgraw
jakemcgraw / truph_photo.js
Created November 1, 2010 20:13
Do like Facebook/Twitter
TRUPH = jQuery.extend(true, TRUPH||{}, {
domain: "http://tru.ph",
basePath: "/photo",
getBaseUrl: function(){
return TRUPH.domain+TRUPH.basePath;
},
shebang: "#!"
});
jQuery(function($){
@jakemcgraw
jakemcgraw / hurdur.php
Created April 19, 2011 20:10
The hurdur templating engine for PHP
# hurdur.php
<?php
function hurdur_render($_template, array $params=array()) {
if (isset($params['_template'])) {
trigger_error('_template is reserved');
}
extract($params);
include $_template;
@jakemcgraw
jakemcgraw / interrupt.js
Created May 27, 2011 17:45
How to interrupt a timeout
var pollInterval = 10000,
pollTimeout = null;
function pollSpots() {
printDXSpots();
pollTimeout = window.setTimeout(pollSpots, pollInterval);
}
// ... later ...
@jakemcgraw
jakemcgraw / facebook_gallery_downloader.js
Created June 7, 2011 23:52
Facebook Gallery Downloader
@jakemcgraw
jakemcgraw / geocode.php
Created October 2, 2011 02:03
DOTGO Geocoding Engine
<?php
header("Content-type: text/xml");
if (empty($_POST) || !isset($_POST["sys_query"])) {
echo "<message><content>Invalid request. Try again.<br/>Reply:<br/><a query=\"crbspt loc\" /> Geocode (1 address)</content></message>";
exit;
}
$address = preg_replace('/^(crbspt\s+loc|loc\s+|1\s+)/', '', trim(strtolower($_POST["sys_query"])));