This file contains hidden or 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/env python | |
# | |
# Script to get internal IPs of all your Rackspace Cloud Servers | |
# and output iptables commands to restrict access to the internal | |
# interfaces to your servers (so other Rackspace customers can't | |
# scan/discover/see/exploit your internal services) | |
# | |
# Note that this script will wipe anything you have configured | |
# in iptables and will leave the public Internet-facing interface | |
# wide open. You will need to apply this script on each of your |
This file contains hidden or 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
/** | |
* Unobtrusive scripting adapter for jQuery, lithified | |
* | |
* Requires jQuery 1.6.0 or later. | |
*/ | |
(function($, undefined) { | |
// Shorthand to make it a little easier to call public lithium functions from within lithium.js | |
var lithium; |
This file contains hidden or 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
git log --name-only --no-merges | grep \.rb$ | sort | uniq -c | sort -nr |
This file contains hidden or 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 | |
use lithium\analysis\Logger; | |
use lithium\data\Connections; | |
use lithium\core\Environment; | |
use lithium\action\Dispatcher; | |
/** | |
* This filter intercepts the `run()` method of the `Dispatcher` |
This file contains hidden or 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
/** | |
* Generates a form field with a label, input, and error message (if applicable), all contained | |
* within a wrapping element. | |
*/ | |
public function field($name, array $options = array()) { | |
if ($this->_binding && $this->_binding->errors($name)) { | |
$options['wrap']['class'] = 'error'; | |
} | |
return parent::field($name, $options); |
This file contains hidden or 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 | |
namespace app\extensions\action; | |
/** | |
* Observer for the Observer pattern. When a subject sends a notification for an event, | |
* the registered listeners can act upon it. | |
* | |
* @author hdonner | |
* |
This file contains hidden or 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
Libraries::add('play', array('default' => true, 'resources' => call_user_func(function() { | |
if (!is_dir($resources = str_replace("//", "/", sys_get_temp_dir() . '/resources'))) { | |
$paths = array($resources, "{$resources}/tmp/logs", "{$resources}/tmp/cache/templates"); | |
foreach ($paths as $path) { | |
mkdir($path, 0777, true); | |
} | |
} | |
return $resources; | |
}))); |
This file contains hidden or 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
class BaseModel extends \lithium\data\Model { | |
public static function create(array $data = array(), array $options = array()) { | |
$defaults = array('defaults' => true, 'class' => 'entity'); | |
$options += $defaults; | |
$model = get_called_class(); | |
if (isset($data['_type']) && $data['_type']) { | |
list($namespace, $name) = preg_split("/\\\[^\\\]*$/", $model); | |
$model = $namespace . '\\' . Inflector::humanize(Inflector::pluralize($data['_type'])); |
This file contains hidden or 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
$(document).on('pjax:popstate ', function(event) { | |
if(event.direction == "back") { | |
console.log('executes before page-change'); | |
} | |
}); |
This file contains hidden or 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> | |
<meta charset="utf-8"> | |
<style> | |
text { | |
font: 10px sans-serif; | |
} | |
</style> | |
<body> |