Skip to content

Instantly share code, notes, and snippets.

View jimbojsb's full-sized avatar

Josh Butts jimbojsb

View GitHub Profile
@jimbojsb
jimbojsb / gist:5df104147704c1d96302
Last active August 29, 2015 14:09
Mysql has gone away
public function processJob($job)
{
try {
// stuff
} catch(Exception $e) {
if(Offers\Model::getDb()->errno() == 2006) {
Offers\Model::connectDb();
$this->processJob($job);
} else {
throw $e;
<?php
public function getActionText()
{
session_start();
if($this->coupon_image) {
$action = 'view coupon';
} else if($this->in_store) {
if($this->product_deal) {
$action = 'get deal';
@jimbojsb
jimbojsb / nav-list.less
Last active February 6, 2018 21:57
.nav-list for Bootstrap 3.0
.nav-list {
padding-left: 15px;
padding-right: 15px;
margin-bottom: 0;
}
.nav-list > li > a,
.nav-list .nav-header {
margin-left: -15px;
margin-right: -15px;
All,
In an effort to try and figure out how we can get more done, I need to collect some more data on what we're currently doing and how long it's taking. As I mentioned last week, please make sure to log work on tickets at the time the work is done, don't save it until the ticket is complete. For tickets that take >1 day, I would expect this means you're at least logging work on them twice a day. I want to make sure the estimates and work logs on the ticket are for programming time only. Don't factor in the auxiliary tasks like code reviews or acceptance meetings in either the estimates or the work logs. If you have to go spend 2 hours learning something to get a ticket accomplished, go ahead and count that as a work log, and also include it in the estimates.
The main things i'm trying to learn are 1) how much capacity do build things do we actually have, and 2) can we get more by improving efficiency, and if not, how many people do we need to hire. With that in mind, and looking at past weeks' number o
@jimbojsb
jimbojsb / gist:5551751
Created May 10, 2013 00:58
Hack way to get XML into a corresponding PHP array
<?php
$array = json_decode(json_encode(simplexml_load_string($str)), true);
@jimbojsb
jimbojsb / gist:5375295
Created April 12, 2013 21:31
Static function singleton
---foo.php
Namespace mylib;
class Foo implements ArrayAccess
{
public function _call()
}
--bar.php
@jimbojsb
jimbojsb / Breadcrumbs.php
Created March 18, 2013 16:20
viewhelper
<?php
namespace Genoa\Viewhelper;
class Breadcrumbs
{
protected $crumbs;
public function __construct($items)
{
foreach ($items as $text => $link) {
@jimbojsb
jimbojsb / Cjftp.php
Created March 15, 2013 19:27
splfileobject
<?php
namespace Genoa\Data\Transport;
use Genoa\Model\Provider;
use Psr\Log\LoggerInterface;
class Cjftp extends \SplFileObject
{
const TEMP_DIR = "/tmp/genoa";
@jimbojsb
jimbojsb / DocumentTest.php
Last active December 14, 2015 20:19
setget test
public function testSetGet()
{
$d = new Document;
$d->foo[] = 'bar';
$this->assertEquals(['bar'], $d->foo);
$d->bar = 'baz';
$test = $d->bar;
$test = 'foo';
{
"_id": "foo",
"mapping": {
"1->2->3": "tag1",
"$woozles!!": "tag2"
},
"origin": {
"name": "Walmart.com",
"slug": "walmart"
}