Skip to content

Instantly share code, notes, and snippets.

Jonathon Hill compwright

Block or report user

Report or block compwright

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
compwright / flatten.js
Created Aug 23, 2016
Flattens an array of arbitrarily nested arrays of integers into a flat array of integers
View flatten.js
'use strict';
Array.prototype.flatten = function() {
var flattened = []; {
if (Array.isArray(element)) {
// If the array element is an array,
// flatten it, then push each element
// onto the master flattened array.
View output.txt
Macbooks-MacBook-Pro:toyoursuccess jhill$ ./
Updating Database to Latest Revision
Exporting Database
** Message: Connected to a MySQL server
** Message: TokuDB detected, creating dummy table for CS
** Message: Started dump at: 2016-04-15 11:24:37
compwright / internal-receiverd.log
Created Oct 5, 2015
internal-receiverd.log (pairing issue)
View internal-receiverd.log
[05/Oct/2015 16:26:08] INFO [] RECV: limited-claim-status
[05/Oct/2015 16:26:08] INFO [] Dispatching to: _cmd_limited_claim_status
[05/Oct/2015 16:26:08] INFO [] SEND: 267 eyJzdGF0dXMiOiAiY2xhaW1pbmctY29uZmlndXJlIn0=
[05/Oct/2015 16:26:13] INFO [] RECV: limited-claim-status
[05/Oct/2015 16:26:13] INFO [] Dispatching to: _cmd_limited_claim_status
[05/Oct/2015 16:26:13] INFO [] SEND: 267 eyJzdGF0dXMiOiAiY2xhaW1pbmctY29uZmlndXJlIn0=
[05/Oct/2015 16:26:15] INFO [] configuring...
Stopping postgresql-server service: [ OK ]
Linking postgres time zone data
Mon Oct 5 16:25:58 UTC 2015
compwright / named_arguments.php
Created Sep 2, 2013
Illustrating how to optionally support named argument arrays in PHP methods
View named_arguments.php
function getFriends(
$user_id = null,
$screen_name = null,
$cursor = -1,
$skip_status = false,
$include_user_entities = false
) {
// Support optionally named parameters via an array
compwright / Process_Manager.php
Created Dec 5, 2012
Demo code used in my "Multitasking in PHP" presentation at the December 2012 Atlanta PHP user group meetup
View Process_Manager.php
class Process_Manager implements Countable
protected $processes = array();
protected $is_child = FALSE;
public function count()
return count($this->processes);
compwright /
Created Nov 29, 2012
Roll your own MAMP development environment
# This file is a reference script for the blog post
# and is not intended to be run as a stand-alone install script.
# Some manual steps will be required, please read the blog post before attempting
# to use this script.
# Tutorial:
# Download and install XQuartz from
compwright / popup.php
Created Nov 16, 2012
Window popup hack to establish a session inside of a Facebook app iframe in Safari
View popup.php
<script type="text/javascript">
// Configure these settings in your config/application.php file:
// $config['fb_page_url'] = '';
// $config['fb_app_id'] = '12345667890825978';
var top_frame_url = '<?php echo config_item('fb_page_url'); ?>/app_<?php echo config_item('fb_app_id'); ?>';
<?php if (isset($_COOKIE['PHPSESSID'])): ?>
// @HACK: pop-up a window if the page is clicked (anywhere) which will access the
// host domain so we can set cookies in Safari
compwright / AddressHelper.php
Created Aug 27, 2012 — forked from Jonathonbyrd/AddressHelper.php
Parse Address :: This function is designed to parse a complete street address using PHP. If it can't figure out the parsing itself, then it sends the address to google to have google parse the street address.
View AddressHelper.php
* @author Jonathon Byrd
* @package Address Parsing
class AddressHelper extends ObjectBase
You can’t perform that action at this time.