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 | |
/** | |
* Program Cache Behavior | |
* | |
* Behavior for making cache calls generic in the model layer. Assumes that the | |
* passed in ID is uuid. | |
* | |
* Things to change: | |
* Different method for handling directory building | |
* Support for cache configs other than the default (partially implemented) |
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 DynamicFindBehavior extends ModelBehavior { | |
public $mapMethods = array( | |
'/^(find){1}[^(all|by)]{1}(.)+(by){1}(.)+$/' => '_find' | |
); | |
public function _find(&$model, $method, $cond = null) { | |
$fields = $ret = array(); | |
$virtual = $_field = $_cond = false; | |
$tmp = array_merge(array_keys($model->schema()), array_keys($model->virtualFields)); |
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
# Numerous always-ignore extensions | |
*.diff | |
*.err | |
*.orig | |
*.log | |
*.rej | |
*.swo | |
*.swp | |
*.vi | |
*~ |
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
# Exit early if users don't pass at least 1 argument | |
if phantom.args.length < 1 | |
console.log "Usage: phantomjs run-jasmine.coffee URL [timeout]" | |
phantom.exit() | |
# Collect the passed int args or set to default value | |
url = phantom.args[0] | |
timeout = phantom.args[1] or 6000 | |
# Create the page object to load the test page in |
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
/*global phantom:true, console:true, WebPage:true, Date:true*/ | |
(function () { | |
var url, timeout, page, defer; | |
if (phantom.args.length < 1) { | |
console.log("Usage: phantomjs run-mocha.coffee URL [timeout]"); | |
phantom.exit(); | |
} | |
url = phantom.args[0]; |
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
Ember.PathCompare = { | |
comparePartsToString: function(parts, compare, index) { | |
var str, first; | |
if (index === undefined) { | |
index = parts.length - 1; | |
} else { | |
if (index < 0) { | |
index = (parts.length - 1) - (index * -1); | |
} | |
} |
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
App.Router.map(function() { | |
this.resource('posts', function() { | |
this.resource('post', { path: '/:post_id' }, function() { | |
this.resource('permissions', function() { ... }); | |
}); | |
}); | |
}); | |
App.PermissionsRoute = Ember.Route.extend({ | |
model: function() { |
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
task :test do | |
cmd = 'shell command to run' | |
rd, wr = IO::pipe | |
pid = Process.fork do | |
$stdout.reopen(wr) | |
rd.close | |
exec(cmd) | |
end | |
wr.close | |
rd.each { |line| puts line } |
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 SeedShell extends AppShell { | |
public $seedFile = 'seed.php'; | |
public $seedDevFile = 'seed_dev.php'; | |
public function main() { | |
$this->includeFile($this->absolutePath($this->getFile())); | |
} |
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
battle = (function() { | |
function completelyAccurateBattleCalculator() { | |
return Math.floor((Math.random()*10)+1); | |
} | |
function predictWinner(i) { | |
if (i >= 1 && i < 5) { | |
return 'goku'; | |
} else if (i > 5 && i <= 10) { | |
return 'jl'; |
OlderNewer