Skip to content

Instantly share code, notes, and snippets.

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;
$('.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));
});
#!/bin/bash
#
# git-svn-diff originally by (http://mojodna.net/2009/02/24/my-work-git-workflow.html)
# modified by mike@mikepearce.net
#
# 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\///'`
#!/usr/bin/env ruby
## So, post to the affiliatewindow login and see what happens.
# Get the libraries
require 'uri'
require 'net/http'
class TestLogin
@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);
}
Given /^I am logged in as "([^"]*)" with password "([^"]*)"$/ do |user, password|
visit "http://www.website.com:82/login"
#Is there a 'logout'?
if (response_body.match('<span>Login</span>')) then
fill_in "email", :with => user
fill_in "password", :with => password
click_button "Login"
end
response_body.should contain("Your Accounts")
@MikePearce
MikePearce / gist:1129317
Created August 6, 2011 13:13
leedshack
<VirtualHost *:80>
ServerName leedshack.dev
DocumentRoot /Users/mikeypearce/Sites/leedshack/public
<Directory "/Users/mikeypearce/Sites/leedshack/public">
Options FollowSymLinks
#RewriteEngine On
#RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
#RewriteRule ^(.*)$ /Users/mikeypearce/Sites/leedshack/public/index.php [L]
Options FollowSymLinks
/**
* Click link or button to trigger js event
* (for buttons that submit forms, use "press"
*
* @When /^I click on the text "([^"]*)"$/
*/
public function iClickOnTheText($text)
{
$session = $this->getSession();
$element = $session->getPage()->find(
@MikePearce
MikePearce / post-receive
Created November 1, 2012 01:11
Basic post-receive hook
#!/usr/local/bin/php
<?php
$staging_directory = '/var/www/engni_test/';
$webroot_directory = '/var/www/engni_test_live/';
echo "****************************************************\n";
echo "*** BEGIN POST-RECEIVE\n";
echo "****************************************************\n";
echo "*** 1. checkout test\n";

#Introduction If you're a php developer on ubuntu, there comes the time where you have to install/reinstall your system. I did it already a few times and i decided to write down the steps for a typical web developer stack with php. This is for a developer machine and not for live environment!

I hope it's a help also for you!

Setup OSX-like keymapping on Ubuntu: http://task3.cc/881/configure-the-keyboard-for-your-macbook-and-ubuntu-12-04/