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);
#!/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;
<?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.
#!/bin/bash
# If it redirects to http://www.facebook.com/login.php at the end, wait a few minutes and try again
EMAIL='YOUR_EMAIL' # edit this
PASS='YOUR_PASSWORD' # edit this
COOKIES='cookies.txt'
USER_AGENT='Firefox/3.5'
<?php
class FacebookBase {
public static $curlOpts = array(
CURLOPT_CONNECTTIMEOUT => 10,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 60,
CURLOPT_USERAGENT => 'facebook-php',
);