Skip to content

Instantly share code, notes, and snippets.

@MikePearce
MikePearce / AWESOME.php
Created October 20, 2010 11:31
Needed to loop through a multiarray and replace {id} with something inside a class. Lambda functions FTW
/**
* Loop through the meta fields looking for things to replace
* @param array $replace
*/
protected function _metaReplacements(array $replace)
{
$doReplace = function(&$item, $key) use ($replace) {
foreach($replace AS $needle => $replace) {
$item = preg_replace('/'. $needle .'/', $replace, $item);
}
#!/usr/bin/env ruby
## So, post to the affiliatewindow login and see what happens.
# Get the libraries
require 'uri'
require 'net/http'
class TestLogin
#!/bin/bash
#
# git-svn-diff originally by (http://mojodna.net/2009/02/24/my-work-git-workflow.html)
# modified by [email protected]
#
# Generate an SVN-compatible diff against the tip of the tracking branch
# Get the tracking branch (if we're on a branch)
TRACKING_BRANCH=`git svn info | grep URL | sed -e 's/.*\/branches\///'`
$('.addSourceMode').click(function() {
// Dupe the srcMode and append
srcModeT = $('.sourceModeTemplate').clone();
srcModeT.removeClass('sourceModeTemplate');
srcModeT.show();
// No LiveQuery Here! When this is changed, change the srcmode!
srcModeT.children('.srcModeSelector').change(function() {
doSrcModeMagic($(this));
});
users.prototype = {
init: function() {
// OK, we need to replace the table now
$.getJSON
(
'/settings/getclientuserlist/'+$('#changeDgrp :selected').text(),
function(dataNew)
{
// Make this stuff available in the whole object.
this.data = dataNew;