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.
| server.use((function () { | |
| var | |
| /** | |
| * Checks if a request parameter has been defined. | |
| */ | |
| contains = function (parameter) { | |
| return this.params[parameter] !== undefined; | |
| }, | |
| /** |
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.
| #!/bin/bash | |
| # | |
| # Copyright 2012, Tim Branyen @tbranyen <[email protected]> | |
| # Dual licensed under the MIT and GPL licenses. | |
| # | |
| # Automatically download and install the Backbone Boilerplate. | |
| # | |
| # Install: wget -O - https://gist.github.com/raw/1596382/bbb.sh > /usr/local/bin/bbb | |
| # chmod +x /usr/local/bin/bbb | |
| # |
| # HTTP Status Cats | |
| # Apache (htaccess) config created by @dave1010 | |
| # Licensed CC BY 2.0 | |
| # Images CC BY 2.0, from GirlieMac's photostream: | |
| # http://www.flickr.com/photos/girliemac/sets/72157628409467125/with/6508023065/ | |
| # Usage: copy save this file as .htaccess or add it to your httpd.conf | |
| ErrorDocument 404 '<a href="http://www.flickr.com/photos/girliemac/6508022985/" title="404 - Not Found by GirlieMac, on Flickr"><img src="http://farm8.staticflickr.com/7172/6508022985_b22200ced0.jpg" width="500" height="400" alt="404 - Not Found"></a>' |
| # The beginnings of a declarative model syntax for CoffeeScript. | |
| # SEE: http://almostobsolete.net/declarative-models-in-coffeescript.html | |
| # Thomas Parslow | |
| # Email: [email protected] | |
| # Twitter: @almostobsolete | |
| # The top part is the setup, see below that for the demo | |
| # To see this run right away try copy pasting it into the 'Try | |
| # CoffeeScript' box at http://jashkenas.github.com/coffee-script/ |
| <?php | |
| class DefaultController extends Controller | |
| { | |
| /** | |
| * Dashboard page. | |
| * @Permissions(perm="dashboard_view") | |
| * @Route("/", name="ITEDashboardBundle_index") | |
| * @Template() | |
| * @return array |
| // ==UserScript== | |
| // @name Use Markdown, sometimes, in your HTML. | |
| // @author Paul Irish <http://paulirish.com/> | |
| // @link http://git.io/data-markdown | |
| // @match * | |
| // ==/UserScript== | |
| // If you're not using this as a userscript just delete from this line up. It's cool, homey. |
| # These are my notes from the PragProg book on CoffeeScript of things that either | |
| # aren't in the main CS language reference or I didn't pick them up there. I wrote | |
| # them down before I forgot, and put it here for others but mainly as a reference for | |
| # myself. | |
| # assign arguments in constructor to properties of the same name: | |
| class Thingie | |
| constructor: (@name, @url) -> | |
| # is the same as: |
| #!/bin/sh | |
| # Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the | |
| # CREATE block and create them in separate commands _after_ all the INSERTs. | |
| # Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk. | |
| # The mysqldump file is traversed only once. | |
| # Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite | |
| # Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite |
| // includes bindings for fetching/fetched | |
| var PaginatedCollection = Backbone.Collection.extend({ | |
| initialize: function() { | |
| _.bindAll(this, 'parse', 'url', 'pageInfo', 'nextPage', 'previousPage'); | |
| typeof(options) != 'undefined' || (options = {}); | |
| this.page = 1; | |
| typeof(this.perPage) != 'undefined' || (this.perPage = 10); | |
| }, | |
| fetch: function(options) { |