Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View justinrainbow's full-sized avatar

Justin Rainbow justinrainbow

View GitHub Profile
<?php
/**
* PluginRoute class.
*
* Route class for plugins that allows you to clean up urls for plugins
* without tons of calls to Router::connect() to shorten controller names in urls.
*/
class PluginRoute extends CakeRoute
{
@m3nt0r
m3nt0r / default.tpl
Created September 21, 2010 05:58
TwigView for CakePHP
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
{{ html.charset() }}
<title>{{ 'CakePHP: the rapid development php framework'|trans }}: {{ title_for_layout }}</title>
{{ html.meta('icon') }}
{{ html.css('cake.generic') }}
{{ scripts_for_layout }}
</head>
<body>
@ornicar
ornicar / config.yml
Created October 29, 2010 12:40
DoctrineUserBundle YAML config
doctrine_user.config:
db_driver: odm
class:
model:
user: Bundle\ExerciseUserBundle\Document\User
group: ~
permission: ~
form:
user: ~
group: ~
@lsmith
lsmith / a.js
Created May 22, 2011 13:57
Using YUI 3's groups config to support fetching non-YUI module js files ala requireJS pathing or explicit url
We couldn’t find that file to show.
@nzakas
nzakas / anyword.js
Created July 23, 2011 19:33
"Any word" filter for YUI Autocomplete
/*
* Use the following in the "resultFilters" option when creating a YUI 3 Autocomplete
* widget. This will return matches when *any* of the words in the query string match.
* This is opposed to the default "wordMatch", which matches *all* words in the
* query string.
*/
function matchAnyWord(query, results) {
var WordBreak = Y.Text.WorkBreak,

shiminy: minimal es5-shim

Looking at the ES5 compatibility table, several browsers provide everything often used (i. e. not Object.freeze() and friends) except Function.prototype.bind. So I just inline that. Browsers that don't provide other functions also don't include Object.getOwnPropertyNames, so I used it as my test for including the entire shim.

Note that I haven't tested it yet, and it doesn't work for the six Object functions next to each other in the Safari 5 part of the compatibility chart (Safari 5 is deemed good enough).

Update: I added JSON for IE <= 7. JSON is used in a good number of node.js modules.

@paulredmond
paulredmond / .tm_properties
Created January 3, 2012 22:47
My .tm_properties file
TM_GIT = "/usr/local/bin/git"
windowTitle = '$TM_FILEPATH'
fontName = "Anonymous Pro"
fontSize = 14
# Extra files to include
myExtraIncludes = ".tm_properties,.htaccess,.gitignore"
fileBrowserGlob = "{*,$myExtraIncludes}"
@davglass
davglass / expand.js
Created May 2, 2012 20:48
Resolve module meta-data (including gallery) in Node.js with YUI's Loader
#!/usr/bin/env node
var Y = require('yui/io-base'),
//API call to gallery's API
url = 'http://yuilibrary.com/gallery/api/all',
//What module should we resolve?
mod = process.argv[2] || 'gallery-aui-calendar',
//Hack up the JSON from the API into Loader Meta-Data
hack = function(str) {
var json = {};
@rgrove
rgrove / node-scroll-info.js
Created June 6, 2012 21:35
node-scroll-info.js
/*!
Copyright (c) 2012 Ryan Grove. All rights reserved.
Redistribution and use of this software in source and binary forms, with or
without modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
@evansolomon
evansolomon / gist:3108240
Created July 13, 2012 23:37
Command line one liner to find and open function definitions in Sublime Text 2
# Alias ST2's command line tool for a shorter (easier-to-remember) name
alias st="/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl"
# Search for an open Sublime Text to a function definition
function fx() {
ack "function &?$1\(" | awk {'print $1'} | sed 's/:$//g' | xargs st
}
# Example usage from the root of a WordPress repository