Skip to content

Instantly share code, notes, and snippets.

Joe Devon joedevon

Block or report user

Report or block joedevon

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
@piscisaureus
piscisaureus / pr.md
Created Aug 13, 2012
Checkout github pull requests locally
View pr.md

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

View gist:1371524
<script src="LAB.js"></script>
<script>
// put whatever here, for your page's other scripts that you load with <script> tags.
$LAB.script("my_script1.js").script("my_script2.js").wait().script("my_script3.js");
window.fbAsyncInit = function() {
FB.init({appId: 'your app id', status: true, cookie: true,
xfbml: true});
};
@westonruter
westonruter / cdup.sh
Created Aug 5, 2011
Bash shortcut function to cd you to an ancestor directory, named as first argument. Stop having to cd ../../../..
View cdup.sh
#!/bin/bash
# Usage: cdup [DIRNAME]
# Bash shortcut function to cd you to ancestor directory named as first argument.
# If DIRNAME is not supplied, then .. is used.
# Stop having to cd ../../../..
# Use `cd -` to undo, to restore old working directory.
# Use aliases for common directories, like: alias docroot="cdup docroot".
# Add function to your ~/.profile
#
# Example:
@westonruter
westonruter / filterable.php
Created Mar 11, 2011
Adding filtering to any class simply by having it extend the Filterable class.
View filterable.php
<?php
// Builds off of Aspect-Oriented Design demo by Garrett Woodworth:
// <http://phpadvent.org/2010/aspect-oriented-design-by-garrett-woodworth>
class Filters {
protected static $_filters = array();
/**
* Register a new filter; note there could be an array index also provided
* to indicate where in the list order that a callback filter should be applied
@getify
getify / gist:713779
Created Nov 24, 2010
loading google analytics using LABjs
View gist:713779
<!DOCTYPE html>
<html>
<head>
<title>LABjs Demo</title>
</head>
<body>
<!-- some stuff -->
<script src="/js/LAB.js"></script>
@johnkary
johnkary / gist:635035
Created Oct 19, 2010
What is best practice for building a mock used across several tests?
View gist:635035
<?php
/**
* Having trouble building the same mock in my setUp() method.
* What is best practice for building a mock used across several tests?
*
* Error:
* 1) SystemUnderTestTest::testSecondTest
* PHPUnit_Framework_Exception: Class "MockStaffCredential" already exists.
*/
class SystemUnderTest
@johnkary
johnkary / gist:634490
Created Oct 19, 2010
Using PHPUnit 3.5 MockBuilder to create a mock concrete object of an abstract class
View gist:634490
<?php
//Create mock BaseCredential called 'MockAdminCredential' whose 'calculate'
//function will always return true. All other methods will return NULL
//as per the default behavior of a stub.
$this->mockAdminCredential = $this->getMockBuilder('BaseCredential')
->setMockClassName('MockAdminCredential')
->setMethods(array('calculate'))
->getMock()
->expects($this->any())
->method('calculate')
View gist:581868
<!DOCTYPE html>
<!-- Helpful things to keep in your <head/>
// Brian Blakely, 360i
// http://twitter.com/brianblakely/
-->
<head>
<!-- Disable automatic DNS prefetching.
View Sg_Session_SaveHandler_Cache.php
<?php
class Sg_Session_SaveHandler_Cache implements Zend_Session_SaveHandler_Interface {
protected $_cache;
/**
* Session lifetime
*
* @var int
*/
protected $_lifetime = false;
/**
@raphaelstolt
raphaelstolt / redis-glue-test.php
Created May 15, 2010
Redis installation test script
View redis-glue-test.php
<?php
define('TEST_KEY', 'are_we_glued');
$redis = new Redis();
try {
$redis->connect('localhost', 6379);
$redis->set(TEST_KEY, 'yes');
$glueStatus = $redis->get(TEST_KEY);
if ($glueStatus) {
$testKey = TEST_KEY;
echo "Glued with the Redis key value store:" . PHP_EOL;
You can’t perform that action at this time.