Skip to content

Instantly share code, notes, and snippets.

View mattdeclaire's full-sized avatar

Matt DeClaire mattdeclaire

View GitHub Profile
### Keybase proof
I hereby claim:
* I am mattdeclaire on github.
* I am mattdeclaire (https://keybase.io/mattdeclaire) on keybase.
* I have a public key whose fingerprint is 54BB ADFD 9CD2 0CCB C675 9900 D839 C465 E7A7 C74A
To claim this, I am signing this object:
{
"title": "About"
}
@mattdeclaire
mattdeclaire / README.md
Last active August 29, 2015 13:58
Backbone Prevent Close

Proof on concept

I'm trying to to create a smooth mechanism for a common feature:

Are you sure? You'll lose your changes.

I tried to use onBeforeClose() return false, but it didn't work, and that feature is deprecated anyway.

This strategy allows you to implement preventClose() on a view.

@mattdeclaire
mattdeclaire / layout.mustache
Created August 9, 2013 17:38
Attempt at Mustache inheritance, using compound inheritance blocks.
<html>
<head>
<title>{{$title}}My Site{{/title}}</title>
</head>
<body>
{{$content}}
<p>Hello World.</p>
{{/content}}
</body>
</html>
@mattdeclaire
mattdeclaire / alt-page.html
Last active December 19, 2015 22:58
Examples of Mustache template inheritance. Includes content overrides (sub-page), and content concatenation (alt-page).
<html>
<head>
<title>Alt Page | My Site</title>
</head>
<body>
<p>Hello Alt Page.</p>
<p>Some extra stuff.</p>
</body>
</html>
@mattdeclaire
mattdeclaire / gist:3093905
Created July 11, 2012 21:58
PHP: array_unique_arrays()
<?php
/**
* Returns a unique array of given array of arrays.
* @param array $array Array containing duplicates.
* @param string $key If supplied, array comparison will use this key only.
* @param bool $preserve_keys If true, the keys will be preserved in the result.
* @return array Array without duplicate arrays.
*/
function array_unique_arrays($array, $key = false, $preserve_keys = false) {