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
/** | |
* Runs before the action | |
* @param CAction $action The action to be run | |
* @return boolean Whether to run the action or not | |
*/ | |
public function beforeAction($action) { | |
Yii::beginProfile("Run Action"); | |
return parent::beforeAction($action); | |
} | |
/** |
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 | |
class Eventable { | |
/** | |
* The events attached to this class | |
* @var Event[] | |
*/ | |
protected $_events = array(); | |
/** | |
* Determines whether an event is defined. |
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 | |
class ActiveRecord { | |
public static function generateCacheKey($field, $id = null) | |
{ | |
return get_class(static::model()).($id !== null ? ':'.$id : '').':'.$field; | |
} | |
public function getCacheKey($field) | |
{ | |
return self::generateCacheKey($field,$this->getPrimaryKey()); |
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
function d(b){e=function(c){return c.replace(/"/,'\\"')};g=function(c){var b=[];for(i=0;i<c.length;i++)b.push(d(c[i]));return b};h=function(b){var f=[];for(a in b)f.push('"'+e(a)+'": '+d(b[a]));return"{"+f.join(",")+"}"};r=Object.prototype.toString.call(b).split(" ").pop().charAt(0);return"S"==r?'"'+e(b)+'"':"N"==r?b:"A"==r?"["+g(b).join(",")+"]":h(b)} |
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 | |
/** | |
* Provides a wrapper for the CKEditor wysiwyg html editor | |
* @author Charles Pick | |
* @package packages.ckeditor | |
*/ | |
class ACKEditorWidget extends CInputWidget { | |
/** | |
* The options for the editor | |
* @var array |
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
# Promise to load a file from the file system | |
# Requirements: | |
# it "should load aliased files correctly", (done) -> | |
# app.load("@lib/Invoke.coffee") | |
# .then (contents) -> | |
# contents.should.contain "this unique text that you are reading right now" | |
# done() | |
# .otherwise (err) -> | |
# throw err | |
# |
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
# Set up our requirements | |
request = require "request" | |
chai = require "chai" | |
chai.should() | |
# The API provides several methods for interacting with users. | |
describe "API user", -> | |
# Get a list of records. The set of returned attributes for list may be different from view. | |
describe "list", -> |
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
from pygments.formatter import Formatter | |
import json | |
class Formatter(Formatter): | |
name = 'JSON' | |
aliases = ['json'] | |
filenames = [] | |
def format(self, tokensource, outfile): | |
arr = [] |
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 AutoWhat | |
constructor: -> | |
console.log "constructing" | |
foo: => console.log this | |
window["whatever"] = -> | |
AutoWhat::constructor.apply this, arguments | |
for attr, val of AutoWhat:: | |
window["whatever"]::[attr] = val | |
b = new whatever |
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
<article about="/spin/latest/"> | |
<partial template="article-header"> | |
<h1>What's been spinning on the radio?</h1> | |
</partial> | |
<partial template="signup-link" /> | |
<p> | |
<span property="stats.total"></span> | |
<if condition="stats.total == 1">Recent spin.</if> | |
<else>Recent spins.</else> | |
Click for full playlist. |