This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Sg_Session_SaveHandler_Cache implements Zend_Session_SaveHandler_Interface { | |
protected $_cache; | |
/** | |
* Session lifetime | |
* | |
* @var int | |
*/ | |
protected $_lifetime = false; | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<!-- Helpful things to keep in your <head/> | |
// Brian Blakely, 360i | |
// http://twitter.com/brianblakely/ | |
--> | |
<head> | |
<!-- Disable automatic DNS prefetching. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>LABjs Demo</title> | |
</head> | |
<body> | |
<!-- some stuff --> | |
<script src="/js/LAB.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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}); | |
}; |
OlderNewer