Skip to content

Instantly share code, notes, and snippets.

@dmachi
dmachi / scroll.html
Created April 22, 2011 02:51
scrollbar approximation
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"/>
<meta name="apple-mobile-web-app-capable" content="yes" />
<title>EdgeToEdgeDataList</title>
<link href="../themes/iphone/base.css" rel="stylesheet">
<link href="../themes/iphone/TabBar.css" rel="stylesheet"></link>
@dmachi
dmachi / app.js
Created April 6, 2011 21:13
Some sample files for dojox/application
efine(["dojo", "dojox/application"], function(dojo, Application) {
app = new Application({
"id": "test",
"author": "jdoe",
"description": "A Test Application",
"defaultScene": {
"$ref": "#scenes.main"
},
"splash": "splash",
@dmachi
dmachi / LocalStorage.js
Created March 22, 2011 05:26
LocalStorage wrapper providing dojo.store interface
define("dojo/store/LocalStorage", ["dojo", "dojo/store/util/QueryResults", "dojo/store/util/SimpleQueryEngine"], function(dojo) {
dojo.declare("dojo.store.LocalStorage", null, {
constructor: function(/*dojo.store.LocalStorage*/ options){
// summary:
// localStorage based object store.
// options:
// This provides any configuration information that will be mixed into the store.
// This should generally include the data property to provide the starting set of data.
if (!dojo.global.localStorage){
@dmachi
dmachi / defamate.js
Created March 3, 2011 18:24
Deferred Animation - defamate
dojo.defamate=function(animation ){
if (animation && !animation.play){
animation = new dojo.animateProperty(animation);
}
var def = new dojo.Deferred(dojo.hitch(animation,"cancel"));
dojo.foreach(["play","pause","stop"],function(p){
def[p] = dojo.hitch(animation, p);
});
animation.onEnd=dojo.hitch(def, "resolve");
/**
* Part of the Eduzine (http://eduzine.edujini-labs.com) Articles.
*
* Downloads available at http://downloads.edujini-labs.com
*
* (C) 2008, Edujini Labs Pvt Ltd
* http://www.edujini-labs.com
*/
dojo.provide("edujini.SubscriptionList");
#!/usr/bin/python
# auth test
import ldap
import ldap.sasl
import sys
user = "uid=dmachi,ou=people,dc=dojotoolkit,dc=org"
pw = sys.argv[1]
@dmachi
dmachi / projectschema.json
Created January 5, 2011 04:17
schema with relations
{
"properties": {
"state": {
"type": "string",
"indexed": true
},
"description": {
"type": "string",
"optional": true
},
@dmachi
dmachi / multirest example.js
Created January 5, 2011 03:49
example using deep resolution
return dojo.when(app.persevere.getStore("Project"),
function(store){
return dojo.when(store.get(data,{resolve: [["triggers"],["destination"],["jobs"]]}),
function(data){
var triggers=[];
var queues=[];
var activity=[];
if(!data|| !data.triggers){
return;
}
@dmachi
dmachi / MultiRest.js
Created December 23, 2010 02:02
MultiRest store that wraps JsonRest and Cache for the dojo.store system.
define("dojo/store/MultiRest", ["dojo","dojo/store/JsonRest","dojo/store/Cache", "dojo/store/Memory"], function(dojo) {
var MultiRest=function(options){
// summary:
// MultiRest store is provided with a targetUrl and schemaUrl to allow multiple JsonRest stores/data
// types to be treated as a single dojo.store and to manage json-schema relationships. Requests to
// standard api calls (get,query,put,delete,etc) require a schema or schemaId to be passed in the
// directives to know how to interpret the items / requests. Requests can also include a resolve
// array to tell a get() or query() request to recursively retrieve and add in related objects
// available on the schema.links and requested in the resolve array.
@dmachi
dmachi / gist:751880
Created December 22, 2010 18:25
Example resolve RQL expression
Here are some examples for an idea i had for the depth resolution of items in persevere using rql.
On the clientside, we could translate these functions into a resolve property of the store.get()'s option
parameter (store.get("something", {resolve:[1]}) for example). It would be nice if on the client side we
could decide upon a way to resolve references that will be consistent across implementations, but I'm
still thinking about it. In the mean time, here is the resolve() idea.
Resolutions - These RQL expressions resolve any links contained in an object to the depth identified
by the first parameter. Subsequent parameters are array of properties that should be the
only properties that get resolved at a particular level. ?resolve(depth,depth1list,depth2list,depth3list,...)