Skip to content

Instantly share code, notes, and snippets.

@johnnncodes
johnnncodes / gist:8176318
Last active January 1, 2016 17:19
Using custom validation messages in Sails.js by Rifat (itsrifat) - https://github.com/itsrifat Reference: https://github.com/balderdashy/sails/issues/1173#issuecomment-31327958
// 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'
}
<?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
)
);
# -*- 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"
@johnnncodes
johnnncodes / api.js
Created December 23, 2013 16:16 — forked from fwielstra/api.js
/* 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');
@johnnncodes
johnnncodes / gist:7941786
Created December 13, 2013 09:17
Get nearby placenames using geonames.
http://api.geonames.org/findNearbyPostalCodesJSON?postalcode=4501&country=PH&radius=30&maxRows=30&username=demo
@johnnncodes
johnnncodes / gist:7278495
Created November 2, 2013 12:38
Django Forms ChoiceField Snippets
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'
@johnnncodes
johnnncodes / gist:5276195
Created March 30, 2013 10:09
Backbone.js and Marionette.js references
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/