Skip to content

Instantly share code, notes, and snippets.

View jonotron's full-sized avatar

Jonathan Bowers jonotron

View GitHub Profile
@jonotron
jonotron / backbone.dualstorage.relational.js
Created July 24, 2012 21:43
Recursively create UUIDs on Backbone.RelationalModels when saving via Backbone.Dualstorage
var _create = window.Store.prototype.create; // reference to original create
/**
* Create a slightly more compliant UUID generator
* credit: http://stackoverflow.com/posts/2117523/revisions
*
* @returns generated UUID
*/
var generateId = window.Store.prototype.generateId = function() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
@soemarko
soemarko / theme.html
Created November 26, 2011 16:18
embed github gist to tumblr
<!-- Add the following lines to theme's html code right before </head> -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
<script src="http://static.tumblr.com/fpifyru/VCxlv9xwi/writecapture.js"></script>
<script src="http://static.tumblr.com/fpifyru/AKFlv9zdu/embedgist.js"></script>
<!--
Usage: just add <div class="gist">[gist URL]</div>
Example: <div class="gist">https://gist.github.com/1395926</div>
-->