Skip to content

Instantly share code, notes, and snippets.

View csaunders's full-sized avatar

Christopher Saunders csaunders

View GitHub Profile
@csaunders
csaunders / spine.ajax.prefix.js
Created June 17, 2011 14:28
Ajax Prefixes and Find by ajax query if Spine.Model doesn't exist locally.
(function(Spine, $){
if( typeof Spine.Model.Ajax === "undefined") { throw "This plugin is really intended for use with Ajax driven models"; }
var Model = Spine.Model;
Model.extend({
find: function(id) {
record = this.records[id];
if( !record) {
var self = this;
self.ajaxPrefix = self.singletonPrefix();
$.ajax({
@csaunders
csaunders / gist:972779
Created May 15, 2011 00:39
Alter Table syntax
MigrationSet migrations = new MigrationSet(){{
version(1);
add( new CreateTable("table1", "c", "d", "e") );
version(2);
add(
new AlterTable()
{{
table("table1");
addColumn("f");
}});
function reverse(arr) {
var start = 0, end = arr.length - 1;
while(start < arr){
var tmp = arr[start]
arr[start] = arr[end]
arr[end] = tmp;
++start, --end;
}
}
@csaunders
csaunders / gist:962800
Created May 9, 2011 16:10
Toolbar link issue
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.css" />
<script src="http://code.jquery.com/jquery-1.5.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.js"></script>
</head>
<body>
<div data-role="page" id="page1">
<div data-role="header"><h1>One</h1></div>
@csaunders
csaunders / LongPageBug.html
Created April 20, 2011 14:58
Long page bug in jQuery Mobile?
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.css" />
<script src="http://code.jquery.com/jquery-1.5.2.min.js"></script>
<script src="http://ajax.microsoft.com/ajax/jquery.templates/beta1/jquery.tmpl.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.js"></script>
</head>
<body>
<!-- NOTE: How to replicate bug -->