Skip to content

Instantly share code, notes, and snippets.

Avatar

Scott Chen rightson

View GitHub Profile
@rightson
rightson / app.js
Created Dec 15, 2011 — forked from skypanther/app.js
Draw gridlines in a Titanium window
View app.js
// implement like this:
var window = Ti.UI.createWindow({
backgroundColor:'#fff'
});
// draw the gridlines first so your other elements stack on top of them
// without requiring you to set the z-index property of each
var grid = require('gridlines');
grid.drawgrid(10,window);
View backbone3-router-env.html
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Learning About Backbone.js Routers</title>
</head>
<body>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="http://documentcloud.github.com/underscore/underscore-min.js"></script>
@rightson
rightson / backbone3-router-example.js
Created Jun 24, 2012
Backbone JS Router example
View backbone3-router-example.js
var myRouter = Backbone.Router.extend({
routes: {
":foo": "func1",
":foo/:bar" : "func2",
"*action" : "funcU"
},
func1: function(p1) {
alert('func1: '+p1);
console.log('func1: '+p1);
},
View backbone2-view-env.html
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Learning About Backbone.js Views</title>
<style type="text/css">
#container{ padding:20px; border:1px solid #333; width:400px; }
#list-template{ display:none; }
</style>
</head>
View backbone2-create-my-model.js
myModel = new Backbone.Model({
data:[
{ text: "Google", href: "http://google.com" },
{ text: "Facebook", href: "http://facebook.com" },
{ text: "Youtube", href: "http://youtube.com" }
]
});
View backbone2-create-view.js
var myView = Backbone.View.extend({
initialize: function () {
console.log('create view');
},
el: '#container',
events: {
"click button": "render"
},
template: $('#list-template').children(),
render: function() {
You can’t perform that action at this time.