Skip to content

Instantly share code, notes, and snippets.

Avatar

Josh Butts jimbojsb

View GitHub Profile
View gist:5df104147704c1d96302
public function processJob($job)
{
try {
// stuff
} catch(Exception $e) {
if(Offers\Model::getDb()->errno() == 2006) {
Offers\Model::connectDb();
$this->processJob($job);
} else {
throw $e;
View gist:9776400
<?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 Feb 6, 2018
.nav-list for Bootstrap 3.0
View nav-list.less
.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;
View gist:6424630
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
Hack way to get XML into a corresponding PHP array
View gist:5551751
<?php
$array = json_decode(json_encode(simplexml_load_string($str)), true);
@jimbojsb
jimbojsb / gist:5375295
Created Apr 12, 2013
Static function singleton
View gist:5375295
---foo.php
Namespace mylib;
class Foo implements ArrayAccess
{
public function _call()
}
--bar.php
View Breadcrumbs.php
<?php
namespace Genoa\Viewhelper;
class Breadcrumbs
{
protected $crumbs;
public function __construct($items)
{
foreach ($items as $text => $link) {
View Cjftp.php
<?php
namespace Genoa\Data\Transport;
use Genoa\Model\Provider;
use Psr\Log\LoggerInterface;
class Cjftp extends \SplFileObject
{
const TEMP_DIR = "/tmp/genoa";
View DocumentTest.php
public function testSetGet()
{
$d = new Document;
$d->foo[] = 'bar';
$this->assertEquals(['bar'], $d->foo);
$d->bar = 'baz';
$test = $d->bar;
$test = 'foo';
View gist:5117857
{
"_id": "foo",
"mapping": {
"1->2->3": "tag1",
"$woozles!!": "tag2"
},
"origin": {
"name": "Walmart.com",
"slug": "walmart"
}
You can’t perform that action at this time.