Skip to content

Instantly share code, notes, and snippets.

Jim Rubenstein jimrubenstein

Block or report user

Report or block jimrubenstein

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
jimrubenstein / _git-objects-restore.php
Last active Nov 27, 2019
Restore files from .git/objects
View _git-objects-restore.php
define('DIR', 'tree');
define('FILE', 'blob');
function main() {
$root_object = 'f3c8ec92f83e2a87c1d00a5681598126e23ab356';
restore_object($root_object, 'restored');
jimrubenstein / ruleset.xml
Last active Apr 20, 2018
Custom PHP Code Sniffer ruleset, uses PSR2 as a base and uses tabs for indenting instead of spaces.
View ruleset.xml
<?xml version="1.0"?>
<ruleset name="CustomCfg">
PSR2 style guide + tab indent instead of space.
<arg name="tab-width" value="4"/>
<rule ref="PSR2">
<exclude name="Generic.WhiteSpace.DisallowTabIndent" />
View .env
jimrubenstein / An Example Controller.php
Created Feb 13, 2016
Extend/Manipulate the behavior of the Eloquent Query Builder to do custom things with your ORM-built queries
View An Example Controller.php
<?php namespace App\Http\Controllers\Party;
use App\Http\Controllers\Controller as BaseController;
use App\Party;
use Session;
use Redirect;
use Request;
use URL;
class Rsvp extends BaseController {
View usage.js
function getPageHistory() {
var hist = $.cookie('history');
try {
hist = JSON.parse(hist);
if (false == $.isArray(hist)) hist = [];
catch (e)
View 01_actual.blade.php
<div class="campaign-property-container">
<div class="campaign-property-value">
<? if ($Campaign->started()): ?>
<? if ($Campaign->running()): ?>
<span class="campaign-status mod-running">Running</span>
<? elseif ($Campaign->ended()): ?>
<span class="campaign-status mod-ended">Ended</span>
<? elseif ($Campaign->pending()): ?>
<span class="campaign-status mod-scheduled">Scheduled</span>
<? endif; ?>
View NoCache.php
<?php namespace App\Http\Middleware;
use Closure;
class NoCache {
* Handle an incoming request.
* @param \Illuminate\Http\Request $request
View gist:178bd0fcb8ff73b3b233
$ php callable_test.php
class Test {
public function __invoke() {}
jimrubenstein / gist:e68e4011ebd4f4850762
Last active Aug 29, 2015
make a closure out of a callable
View gist:e68e4011ebd4f4850762
function closureify(callable $fn)
return function() use ($fn) {
return call_user_func_array($fn, func_get_args());
View gist:317467dc97fc436e994e
$ mysql -e 'show slave status \G' -u root | grep "Running: No"
$ echo $?
$ mysql -e 'show slave status \G' -u root | grep "Running"
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
$ echo $?
You can’t perform that action at this time.