Skip to content

Instantly share code, notes, and snippets.

View davemo's full-sized avatar
😀

David Mosher davemo

😀
View GitHub Profile
// 1. Instantiate a Loader in the global.html template
SREPLoader = new YAHOO.util.YUILoader({
base: '{% vurl "/static/script/" %}',
loadOptional: false,
combine: true,
require:["json"],
filter: "MIN",
allowRollup: true,
onSuccess: function() {
// 1. Custom Namespace and modules
// modules.js
YOURAPP = {};
YOURAPP.modules = { // some sample modules
'jq' : { type: 'js', varName: 'jquery', fullpath: 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js' },
'jqueryui' : { type: 'js', varName: 'jqueryui', path: 'js/jquery-ui-1.8rc3.custom.min.js', requires: ['jq', 'jqueryui.css'] },
'jqueryui.css' : { type: 'css', varName: 'jqueryui.css', path: 'css/redmond/jquery-ui-1.8rc3.custom.css' },
'tester' : { type: 'js', varName: 'tester', path: 'js/tester.js' }
};
@davemo
davemo / gist:328454
Created March 10, 2010 21:44
YUI 3 Loader + Django Templates
// 1. Custom Namespace and modules
// modules.js
YOURAPP = {};
YOURAPP.modules = { // some sample modules
'jq' : { type: 'js', varName: 'jquery', fullpath: 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js' },
'jqueryui' : { type: 'js', varName: 'jqueryui', path: 'js/jquery-ui-1.8rc3.custom.min.js', requires: ['jq', 'jqueryui.css'] },
'jqueryui.css' : { type: 'css', varName: 'jqueryui.css', path: 'css/redmond/jquery-ui-1.8rc3.custom.css' },
'tester' : { type: 'js', varName: 'tester', path: 'js/tester.js' }
};
// Generates Icons and Styling for <a> elements based on the href parameter value
// for example: <a href="http://www.twitter.com/dmosher"> would get a twitter icon and some default styling
// Ideally, I'd like to have a list like ["twitter", "facebook", ...] that I can loop over to generate the selectors without repetition.
@import sprites.sass
!sprite_default_size = 16px
!sprite_default_margin = 10px
!sprite_image_default_width = !sprite_default_size
!sprite_image_default_height = !sprite_default_size
application: unknown
version: unknown
runtime: python
api_version: 1
# DELETE_ME/ is replaced by '' (empty string)during the build/deploy process.
# dev_appserver will not load _any_ files in the skip_files section
# any more, so during devel, we do not want to have skip_files capture
# .google_appengine or any other python libs. however, we do not want to deploy
# these files, so we skip them during deployment.
// A vehicle
{
id : XIFJS93,
make : 'Honda',
model : 'Civic',
year : 1999,
engine : [9FAJFI]
...
}
<script type="text/javascript">
SREP.Loader = YUI({
base: '{% vurl "/static/script" %}',
modules: SREP.Modules.common,
charset: 'utf-8',
timeout: 10000,
root: "",
combine: false,
filter: "raw",
@davemo
davemo / gameOfLife.js
Created November 3, 2010 22:09
BDD driving the game of life problem using Javascript and Jasmine BDD
//Real implementation
var Universe;
var Cell = function() {
this.size = 1;
this.neighbors = [];
this.breathing = true;
};
Cell.prototype.isDead = function() {
{
results : [
{
"id" : "240949",
"name" : "240949-AWESOME GROCERY STUFF"
},
...
]
}
@davemo
davemo / TestCase.html
Created November 6, 2010 04:11
Testing the way some form elements get floated as a base case.
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Form Float Isolation!</title>
<style type="text/css">
div { /** Basic Scaffolding **/
border: 1px solid #ccc;
}