This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://backbonejs.org/ | |
http://marionettejs.com/ | |
https://github.com/documentcloud/backbone/wiki/Tutorials,-blog-posts-and-example-sites | |
http://backbonefu.com/2011/11/modifying-your-urls-on-the-fly-using-the-request-method-with-sync-in-backbone-js/ | |
http://addyosmani.github.com/backbone-fundamentals/#marionette | |
http://addyosmani.github.com/backbone-fundamentals/#memory-management | |
https://github.com/jsoverson/todomvc/tree/master/labs/architecture-examples/backbone_marionette | |
http://davidsulc.com/blog/2012/04/15/a-simple-backbone-marionette-tutorial/ | |
http://davidsulc.com/blog/2012/04/22/a-simple-backbone-marionette-tutorial-part-2/ | |
http://davidsulc.github.com/backbone.marionette-collection-example/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SearchForm(SearchForm): | |
city = forms.ChoiceField(required=False) | |
province = forms.ChoiceField(required=False) | |
def __init__(self, *args, **kwargs): | |
# DEMO: to get list of fields w/ changed data | |
# example: check if city choice data has changed | |
if 'city' in self.changed_data: | |
self.fields['city'].widget.attrs['class'] = 'show' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://api.geonames.org/findNearbyPostalCodesJSON?postalcode=4501&country=PH&radius=30&maxRows=30&username=demo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* The API controller | |
Exports 3 methods: | |
* post - Creates a new thread | |
* list - Returns a list of threads | |
* show - Displays a thread and its posts | |
*/ | |
var Thread = require('../models/thread.js'); | |
var Post = require('../models/post.js'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! | |
VAGRANTFILE_API_VERSION = "2" | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
config.vm.box = "precise32" | |
config.vm.box_url = "http://files.vagrantup.com/precise32.box" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (Config::has('sentry.key')) { | |
$bufferHandler = new Monolog\Handler\BufferHandler( | |
new Monolog\Handler\RavenHandler( | |
new Raven_Client(Config::get('sentry.key')), | |
Monolog\Logger::WARNING | |
) | |
); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// make a module in node_modules named 'my-validation-utils'. create a index.js file there. and put the following content there: | |
var user = { | |
email:{ | |
required:'Email Required', | |
email:'Should be an email' | |
}, | |
name:{ | |
required:'name required' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Takes a Sails Model object (e.g. User) and a ValidationError object and translates it into a friendly | |
* object for sending via JSON to client-side frameworks. | |
* | |
* To use add a new object on your model describing what validation errors should be translated: | |
* | |
* module.exports = { | |
* attributes: { | |
* name: { | |
* type: 'string', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" type="text/javascript"></script> | |
<link rel="stylesheet" href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.10.3/themes/flick/jquery-ui.css" /> | |
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script> | |
<style type="text/css"> | |
.ui-menu .ui-menu-item a,.ui-menu .ui-menu-item a.ui-state-hover, .ui-menu .ui-menu-item a.ui-state-active { | |
font-weight: normal; | |
margin: -1px; | |
text-align:left; | |
font-size:14px; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// articles per page | |
var limit = 10; | |
// pagination middleware function sets some | |
// local view variables that any view can use | |
function pagination(req, res, next) { | |
var page = parseInt(req.params.page) || 1, | |
num = page * limit; | |
db.articles.count(function(err, total) { | |
res.local("total", total); |
OlderNewer