Skip to content

Instantly share code, notes, and snippets.

@jimrubenstein
jimrubenstein / _git-objects-restore.php
Last active September 15, 2023 19:04
Restore files from .git/objects
#!/usr/local/bin/php
<?php
define('DIR', 'tree');
define('FILE', 'blob');
function main() {
$root_object = 'f3c8ec92f83e2a87c1d00a5681598126e23ab356';
restore_object($root_object, 'restored');
}
@jimrubenstein
jimrubenstein / ruleset.xml
Last active April 20, 2018 22:54
Custom PHP Code Sniffer ruleset, uses PSR2 as a base and uses tabs for indenting instead of spaces.
<?xml version="1.0"?>
<ruleset name="CustomCfg">
<description>
PSR2 style guide + tab indent instead of space.
</description>
<arg name="tab-width" value="4"/>
<rule ref="PSR2">
<exclude name="Generic.WhiteSpace.DisallowTabIndent" />
STRIPE_SECRET_KEY=XXXXXXX
STRIPE_PUBLIC_KEY=YYYYYYY
@jimrubenstein
jimrubenstein / An Example Controller.php
Created February 13, 2016 02:16
Extend/Manipulate the behavior of the Eloquent Query Builder to do custom things with your ORM-built queries
<?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 {
__d("adsAsyncUtils", [], function(a, b, c, d, e, f) {
var g = 30;
function h(arr, iter, progress) {
"use strict";
this.$ParallelForEach0 = arr; //array
this.$ParallelForEach1 = 1; //concurrency
this.$ParallelForEach2 = iter; //iterator
this.$ParallelForEach3 = progress; //progress complete
this.$ParallelForEach4 = 0; //working "threads"
this.$ParallelForEach5 = 0;
# Setting up dnsmasq for Local Web Development Testing on any Device
Please note, these instructions are for OS X Lion.
First, you need to get the IP address of your machine on your local network. In OS X, the easiest place to find this is in System Preferences > Network. If you're using DHCP on your local network, you will want to make sure your computer requests the same IP address when it renews it's IP address lease. I recommend configuring the DCHP Reservation settings on your router to accomplish this. Otherwise, you can specify a manual address in your network settings:
1. Go to *System Preferences > Network*
1. Click *Advanced...*
Views = {
render: function(template, data)
{
if (undefined == JST)
{
throw new Error("JST Templates unavailable");
}
if (undefined == JST[ template ])
{
The Trustees of Reservations: Berkshires
"e" inc.
11:11 Theatre Company
17 Cox
185 Photos
33 Restaurant &amp; Lounge
3rd Wheel Comedy
3Scoops Cafe and Gallery
4th Floor Artists
54th Mass Volunteer Infantry, Company 'A'
@jimrubenstein
jimrubenstein / gist:3152882
Created July 20, 2012 20:00
mandrill library
var request = require('request'),
_ = require('underscore');
var MANDRILL_API_ROOT = 'https://mandrillapp.com/api/1.0/';
function makeMandrill(key)
{
function mandrill(path, opts, callback)
{
console.log(this.key, 'key');
<?
class MyException extends Exception
{
public function getType() { return 'NotException'; }
}
function doTest()
{
$e = new MyException('stupid php', 1);