Skip to content

Instantly share code, notes, and snippets.

@jensarps
jensarps / index.html
Created November 24, 2011 14:13
IDBWrapper tutorial, step 1
<!DOCTYPE html>
<html>
<head>
<title>IDBWrapper Tutorial, Step 1</title>
</head>
<body>
<script type="text/javascript" src="IDBStore.js"></script>
<script type="text/javascript" src="tutorial.js"></script>
</body>
</html>
@jensarps
jensarps / requirejs_config.html
Created October 1, 2011 12:00
Including and configuring RequireJS
<script>
var require = {
baseUrl: 'src/', // all other paths are now relative to this one
paths: {
'implementations': 'platforms/unknown'
}
};
</script>
<script type="text/javascript" src="src/require.js"></script>
@jensarps
jensarps / requiring_features.js
Created October 1, 2011 10:13
Using features
define(['feature!async-promise'],function(embed){
// Now you have embed.Promise available!
})
// All features return the same object, so that you
// can do the following:
define(['feature!async-promise', 'feature!html-element'], function(embed){
// All methods provided by the html-element feature are now
// available in the object returned by the async-promise feature,
@jensarps
jensarps / embedjs-nodecreation.js
Created September 16, 2011 08:55
EmbedJS code examples
// DOM node creation quick'n'easy:
var containerNode = embed.create('div', {
className: 'container box',
innerHTML: '<span>Huh, a container!</span>',
style: {
border: 'solid red 1px'
}
}, parentNode);
@jensarps
jensarps / promise.js
Created February 4, 2010 23:53
Micro Promise implementation
dojox.Promise = function(){
return {
emit: function(data){ // stub function
},
then: function(doneHandler,errHandler){
var promise = new dojox.Promise();
dojo.connect(this, 'emit', function(data){
if(doneHandler && !(data instanceof Error)){