Skip to content

Instantly share code, notes, and snippets.

/*
---------
Copyright 2011, ZangZing LLC. All rights reserved.
*/
function ZZA(c, a, b) {
this.id = c;
this.zzv_id = null;
this.usertype = (this.useridentifier = a) ? 1 : 2;
if (b == undefined) b = false;
@mtrpcic
mtrpcic / gist:1109398
Created July 27, 2011 13:51
HTML5 Fallback Ideas
// PathJS supports both the Hashtag and HTML5 History API now. Some users would like it to automatically fall back to the Hashtag if
// the history API is not supported. Obviously, this can't be the default, as some users want the site to work in browsers with JavaScript
// turned off, and will only use the History API to add transitions and effects to their site.
//
// When using the Hashtag implementation, users must define their routes, and then make sure that they tell PathJS to listen for state changes
// by calling the appropriate method:
Path.listen();
// The `Path.listen()` method is not required when doing HTML5 History API calls, as we have a wrapper method that wraps the native
@mtrpcic
mtrpcic / Testcase.html
Created December 27, 2011 23:41
Code examples for Issue #13 on mtrpcic/pathjs
/*
The following is a concise outline of the test environment that I've set up to test the outcome described in
Issue #13 on the PathJS master branch. This setup is running on a Rails server.
https://github.com/mtrpcic/pathjs/issues/13
*/
// Step 1 - Server, Routes, and Data
// I set up a Rails 3.1.0 server with a 'Widget' model, and the following test route:
@mtrpcic
mtrpcic / examples.js
Created February 3, 2012 01:00
examples
// extensions.js
$.fn.uploader = function(element){
Uploader.show(element);
}
// functions.js
var Uploader = {
"show": function(element){
// code here to show the uploader
},
<<<<<<< HEAD
=======
>>>>>>> 39d7104023dd06ff8515885ce9ece055c601952d
Sales Zen Javascript
--------------------
Client-Side Routing
Client-Side Models
Client-Side Views (EJS)
Widget System
Standardized Resource Pulling (No more $.ajax!)
jQuery, Twitter Bootstrap, jQuery UI
function handler(animate){
return function(path){
get_page(path, animate);
}
}
1. Use a ruby version
rvm use 1.9.2-p248
2. Create a gemset
rvm gemset create myapp
3. In the root of your app, add a file named ".rvmrc" with the following contents:
var routes = {
"/users": function(){},
"/users/:id": function(){},
"/pages": function(){}
}
for(key in routes){
Path.map(key).to(routes[key]);
}
var UsersController = {
"index": function(){
},
"show": function(){
}
"new": function(){
}