Skip to content

Instantly share code, notes, and snippets.

View xeoncross's full-sized avatar

David Pennington xeoncross

View GitHub Profile
@xeoncross
xeoncross / Lazy.php
Created January 30, 2014 16:27 — forked from meglio/Lazy.php
<?php
/**
* Trait Lazy
*
* Allows for lazy initialization of object and class values.
*
* Example:
*
* class Test {
<?php
/**
*
* Helper Class to output correct Twitter Bootstrap Markup.
* Only option for now is the horizontal Form.
*
* Usage :
*
$form = new BootstrapForm('add_user');
$form->addInput('text-input', 'user_name', 'Your name:', true);
@xeoncross
xeoncross / typeahead.usage.html
Created February 17, 2014 22:41
twitter typeahead.js plugin example usage
<!-- http://twitter.github.io/typeahead.js/data/repos.json -->
<input type="text" autocomplete="off" class="form-control"
id="client-search"
data-typeahead-url="./repos.json"
data-typeahead-target="client-id">
<input type="hidden" id="client-id" name="client-id">
#!/usr/bin/php -q
<?php
/**
* Returns tab-delimited latitude,longitude,formatted address for given address from Google Maps API
* @author Warren Stevens (warbaby67@gmail.com)
**/
$base = 'http://maps.googleapis.com/maps/api/geocode/json?';
<?php
function it($m,$p){echo ($p?'✔︎':'✘')." It $m\n"; if(!$p){$GLOBALS['f']=1;}}function done(){if(@$GLOBALS['f'])die(1);}
<?php
class base58
{
static public $alphabet = "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ";
public static function encode($int) {
$base58_string = "";
$base = strlen(self::$alphabet);
while($int >= $base) {
/**
for( $a=1; $a<20; $a++ ) {
echo '----------------------' . PHP_EOL;
echo 'PROJECT_ID :: ' . $a . PHP_EOL;
$last = $c[ 'predis' ]->get( 'round-robin-dispatch' );
$i = $j = -1;
$n = count( $array );
<?php
//DOM Templating classes v7 © copyright (cc-by) Kroc Camen 2012
//you may do whatever you want with this code as long as you give credit
//documentation at http://camendesign.com/dom_templating
class DOMTemplate extends DOMTemplateNode {
private $DOMDocument;
private $keep_prolog = false;
@xeoncross
xeoncross / Controller\HomeController.php
Created March 13, 2014 01:57
Simple HTTP REST Controller wrapper for Silex based on https://gist.github.com/igorw/3646064
<?php
namespace Controller;
class HomeController
{
public function getAction($app)
{
return 'Hello!';
}
<?php
/**
* A simple Facebook PHP example.
*
* - This is not a "Facebook SDK".
* - This example uses Curl, Hash, JSON, Session extensions.
* - This does not use the JavaScript SDK, nor the cookie set by it.
* - This works with Canvas, Page Tabs with IFrames, the Registration Plugin
* and with any other flow which uses the signed_request.