Skip to content

Instantly share code, notes, and snippets.

reloadRecords: function() {
SC.Request.getUrl('/yoururl').json()
.notify(this, '_didRetrieve')
.send();
},
_didRetrieve:function(response) {
if(!SC.ok(response)) {
console.log('Unable to retrieve record');
@tomdale
tomdale / gist:1134558
Created August 9, 2011 16:53
Load remote Handlebars templates
jQuery.get('/templates/foo.handlebars', function(data) {
var template = SC.Handlebars.compile(data);
SC.TEMPLATES['foo'] = template;
})
@oscarrenalias
oscarrenalias / nodeserver.js
Created October 29, 2011 12:37
A very simple Node.js static file server, based on lightnode (https://github.com/ngspinners/lightnode)
//
// A very simple Node.js static file server and Ajax proxy, based on lightnode (https://github.com/ngspinners/lightnode)
//
// Requirements:
// Node.js
// npm for the installation of modules
// lightnode (installed via npm)
//
// How to use, with all dependencies in place:
// node nodeserver.js [/path/to/the/root/folder]
@mythz
mythz / xhr.js
Created November 2, 2011 19:05
Standalone jQuery-like Ajax Client
//Adds $.xhr and jQuery-like $.ajax methods to the prescribed namespace.
//Inspired from David Flanagans excellent cross-platform utils http://www.davidflanagan.com/javascript5/display.php?n=20-1&f=20/01.js
//Includes underscore.js _.each and _.extend methods
//modified to behave like jQuery's $.ajax(), not complete.
(function($) {
var win=window, xhrs = [
function () { return new XMLHttpRequest(); },
function () { return new ActiveXObject("Microsoft.XMLHTTP"); },
function () { return new ActiveXObject("MSXML2.XMLHTTP.3.0"); },
function () { return new ActiveXObject("MSXML2.XMLHTTP"); }
@LuisSala
LuisSala / nodeserver.js
Created December 26, 2011 19:11 — forked from oscarrenalias/nodeserver.js
A very simple Node.js static file server, based on lightnode (https://github.com/ngspinners/lightnode)
//
// A very simple Node.js static file server and Ajax proxy, based on lightnode (https://github.com/ngspinners/lightnode)
//
// How to use:
// node nodeserver.js [/path/to/the/root/folder]
//
// Go to a URL such as http://localhost:8080/somefile.html where somefile.html exists in the current folder
// where node was started, or in the folder provided as a parameter
//
// For proxy requests, use http://localhost:8080/proxy/http://www.yourserver.com/ajaxCall to proxy your Ajax
@ppcano
ppcano / swipe_view.js
Created January 7, 2012 00:05
Ember SwipeView for mobile devices ( using only three master pages with infinite content)
Luh.Ui.SwipeView = Ember.ContainerView.extend({
width: null,
height: null,
content: null,
duration: '1s',
swipeOptions: {
@ppcano
ppcano / swipe.css
Created January 7, 2012 13:57
Ember SwipeView for mobile devices based on SwipeView's approach of @cubiq
.swipe_item {
position: absolute;
-webkit-transform: translateZ(0);
top: 0px;
height: 100%;
width: 100%;
}
.swipe_slider {
position: relative;
@wagenet
wagenet / Assetfile.rb
Created January 13, 2012 20:37
Ember Handlebars Precompile
require 'execjs'
class HandlebarsFilter < Filter
class << self
def contents
@@contents ||= [File.read("headless-ember.js"), File.read("ember.js")].join("\n")
end
def context
@@context ||= ExecJS.compile(contents)
@garth
garth / Jakefile.js
Created January 16, 2012 18:37 — forked from wagenet/Assetfile.rb
Precompile .handlebars templates with Jake (nodejs)
var fs = require('fs')
var vm = require('vm')
var handlebarsjs = fs.readFileSync('path/to/handlebars.js', 'utf8')
var emberjs = fs.readFileSync('path/to/ember.js', 'utf8')
var templatesDir = 'path/to/template/dir'
desc('Compile all .handlebars templates')
task({ 'handlebars': [] }, function () {
process.stdout.write('Compiling .handlebars templates')
@conspirator
conspirator / Grunt Here
Created January 31, 2012 14:17
The following AppleScript opens up Terminal, navigates to the path of the active Finder window, opens that directory in Sublime Text 2, and finally kicks off Grunt.js.
-- ========================================
-- Author: Christopher Webb
-- Web: http://conspirator.co
-- Twitter: http://twitter.com/conspirator
-- ========================================
set finderPath to ""
tell application "Finder"
try