Skip to content

Instantly share code, notes, and snippets.


Ralph Schindler ralphschindler

View GitHub Profile
ralphschindler / array_walk_recursive_key.php
Created Sep 19, 2014
Apply user functions to both keys and values while recursively walking an associative array
View array_walk_recursive_key.php
function array_walk_recursive_key(array $array, callable $valueCallback, callable $keyCallback = null) {
foreach ($array as $n => &$v) {
$n2 = ($keyCallback) ? $keyCallback($n) : $n;
if ($n != $n2) {
$array[$n2] = &$array[$n];
if (is_array($v)) {
View AngularJS-LoneStarPHP.pdf
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
ralphschindler /
Last active Feb 22, 2016
Breaking directories out of a repository into their own repository
git clone ./zf2 ZendServiceAmazon-library;
git clone ./zf2 ZendServiceAmazon-tests;
git init ZendServiceAmazon;
cd ZendServiceAmazon-library;
git filter-branch --subdirectory-filter library/Zend/Service/Amazon -- --all;
git filter-branch --index-filter 'git ls-files -s | sed "s--library/ZendService/Amazon/-g" | GIT_INDEX_FILE=$ git update-index --index-info && mv "$" "$GIT_INDEX_FILE"' HEAD
cd ../;
View bootstrap.php
copy(__DIR__ . '/music.db.original', __DIR__ . '/music.db');
include 'vendor/autoload.php';
return new Zend\Db\Adapter\Adapter(array(
// Sqlite Configuration
'driver' => 'Pdo',
'dsn' => 'sqlite:' . __DIR__ . '/music.db',
ralphschindler / node_mate.rb
Created Oct 6, 2013
Running unsaved JavaScript though Node.js with TextMate 2 Notes: It's basically 2 files, one created with the bundle editor (See the tmCommand), and the actual node runner. This also requires an environment variable to be setup pointing to the node command line utility: TM_NODE=/usr/local/bin/node for node installed via homebrew
View node_mate.rb
require "#{ENV["TM_SUPPORT_PATH"]}/lib/scriptmate"
class NodeScript < UserScript
def lang; "JavaScript" end
def default_extension; ".js" end
def args
def executable; @hashbang || ENV['TM_NODE'] || 'node' end
def version_string

The 231 New Orleanians On Github

(Followers / Following in last column)

Ralph Schindler
View matchNamedAguments.php
function matchNamedArguments($target, $arguments = array())
if (!is_array($arguments) && !$arguments instanceof \ArrayAccess) {
throw new \InvalidArgumentException('$arguments for ' . __CLASS__ . ' must be array or ArrayAccess');
if (is_string($target) || $target instanceof \Closure) {
$r = new \ReflectionFunction($target);
ralphschindler / aop-uow-change-tracking.php
Last active Nov 22, 2020
A aop based Unit Of Work prototype/example with minimal code
View aop-uow-change-tracking.php
* Foo is an Entity
class Foo
protected $bar = 'original';
public function getBar()
ralphschindler / code-complete-stub-generator.php
Last active Mar 14, 2020
IDE code-completion stub generation script that utilizes reflection. (Primary use would be for extension stubs.)
View code-complete-stub-generator.php
define('T', ' ');
define('N', PHP_EOL);
$functions = array();
$classes = array();
$constant_prefix = 'X_';
$php = '<?php' . N;
ralphschindler / example.php
Created Oct 24, 2012
Zend\Db\Sql\Select example usage
View example.php
use Zend\Db\Sql\Select;
// basic table
$select0 = new Select;
// 'SELECT "foo".* FROM "foo"';
You can’t perform that action at this time.