Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
/* | |
* object.watch polyfill | |
* | |
* 2012-04-03 | |
* | |
* By Eli Grey, http://eligrey.com | |
* Public Domain. | |
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. | |
*/ |
import os, sys | |
import datetime | |
import base64 | |
import cloudservers | |
import cloudlb | |
import urllib2 | |
#import paramiko | |
from time import sleep |
var bogart = require('bogart'); | |
var Q = require('promised-io/lib/promise'); | |
var mongoose = require('mongoose'); | |
var PostSchema = new mongoose.Schema({ | |
title: String, | |
body: String, | |
comments: [ CommentSchema ] | |
}); |
// Cross-browser object.watch and object.unwatch | |
// Requires Mootools 1.4 or greater | |
// object.watch | |
(function(){ | |
if (!Object.prototype.watch) { | |
Object.implement('watch',function(prop,handler){ | |
var oldval = this[prop], newval = oldval, | |
getter = function () { | |
return newval; |
<?php | |
/** | |
* Continuation routing examples. Handles URLs in the following forms: | |
* | |
* /posts | |
* /en/posts | |
* /admin/posts | |
* /admin/en/posts | |
* /admin/en/posts.json | |
* /admin/en/posts/4ef16ccc7f8b9aa331000064.json |
Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
$('a.reveal').click(function(event) { | |
event.preventDefault(); | |
var $div = $('<div>').addClass('reveal-modal').appendTo('body'), | |
$this = $(this); | |
$.get($this.attr('href'), function(data) { | |
return $div.empty().html(data).append('<a class="close-reveal-modal">×</a>').reveal(); | |
}); | |
}); |
<?php | |
use lithium\net\http\Media; | |
/** | |
* This re-maps your template paths so you can have stuff like `pages/users_{username}.php` | |
* instead of the Lithium default. | |
*/ | |
Media::type('html', 'text/html', array( | |
'view' => 'lithium\template\View', |
<?php | |
/** | |
* A System model to work with MongoDB from a higher level. | |
* This model will executes various commands as well as store new commands. | |
* The system.js collection is used. | |
* | |
* Warning: There be dragons in here. | |
* | |
*/ | |
namespace app\models; |
use lithium\action\Dispatcher; | |
//Allow admin continuation routes to be made. | |
Dispatcher::config( | |
array( | |
'rules' => array( | |
'admin' => array('action' => 'admin_{:action}') | |
) | |
) | |
); |