Skip to content

Instantly share code, notes, and snippets.

@cj
cj / 0.3.3.js
Created February 21, 2011 17:34
// Start the hash change handling, returning `true` if the current URL matches
// an existing route, and `false` otherwise.
start : function() {
var docMode = document.documentMode;
var oldIE = ($.browser.msie && (!docMode || docMode <= 7));
if (oldIE) {
this.iframe = $('<iframe src="javascript:0" tabindex="-1" />').hide().appendTo('body')[0].contentWindow;
}
if ('onhashchange' in window && !oldIE && ($.browser.msie || docMode >= 8)) {
$(window).bind('hashchange', this.checkUrl);
" by CJ Lazell github.com/cj
" based on - http://github.com/solars/github-vim/
if exists("loaded_github") || &cp
finish
endif
" --- main functions --- "
#!/bin/sh
#
# merge [branchname]
#
# Tries to merge local branch "branchname" into master,
# regardless of what branch you are currently in.
# It will stop you if you are behind & need to pull 1st
#
remote="origin"
<?
// Import Framework
require 'klein.php';
respond('GET', '/hello/[:name]?', function ($request, $response) {
$name = $request->param('name', 'World');
echo "Hello $name!";
});
// Run App
<?
// Import Framework
require 'klein.php';
function visit($uri) {
return dispatch($uri, 'GET', null, true);
}
respond('GET', '/', function ($request, $response) {
// It shouldn't print Hello World to the browser, but it does.....
<?
// Import Framework
require 'klein.php';
function visit($uri) {
return dispatch($uri, null, null, true);
}
respond('GET', '/[:name]?', function ($request, $response){
$name = $request->param('name', 'World');
<?
// Import Framework
require 'klein.php';
function visit($uri) {
return dispatch($uri, null, null, true);
}
respond('GET', '/[:name]?', function ($request, $response){
$name = $request->param('name', 'World');
@cj
cj / index.html
Created July 14, 2011 12:36 — forked from jonalter/index.html
Titanium Desktop file upload example
<html>
<head></head>
<body style="background-color:#ffffff;margin:10px">
<script>
var uploadFile = function(){
var text = document.getElementById('txt');
var dir = Titanium.Filesystem.getResourcesDirectory();
sep = Titanium.Filesystem.getSeparator(),
// filename = 'test.txt',
@cj
cj / readme.md
Created August 10, 2011 13:11
hifi ajax-form snippet

Examples

Basic example, replace .ajax-form with whatever form you want to select:

$('.ajax-form').snippet_ajax_form();

Example using options:

$.fn.snippet_ajax_form.defaults= { hide_on_success: true };

{% block main %}
{% set parent as hifi.get({'id': this.parent})[0] %}
<h2>Series</h2>
{{ parent.title }}<br><br>
<h2>Title</h2>
{{ this.title }}<br><br>