Skip to content

Instantly share code, notes, and snippets.

class window.HomeView extends Backbone.View
template: _.template($('#home').html())
render: (eventName) ->
$(@el).html(@template())
return @
class window.Page1View extends Backbone.View
template: _.template($('#page1').html())
render: (eventName) ->
$(@el).html(@template())
@luiscronicl
luiscronicl / tplParser.js
Last active December 12, 2015 07:29
Function for parsing one Object which represents a directory structure into an array
/**
* @param JSON incoming The JSON with all the strings
* @param array templates The temporary holder of the templates
* @param parentName string Helper string for storing the name of the route
* @return array Array with the parsed routes
* @example parse([dirA: ['example', 'example2'], dirB: ['example3', subdir:['s1','s2']])
* returns ['dirA/example','dirA/example2','dirB/example3','dirB/subdir/s1','dirb/subdir/s2']
*/
function parse(incoming, templates, parentName){
var i;
@luiscronicl
luiscronicl / i18nComparerSpec.coffee
Created February 1, 2013 13:38
Spec for compare i18next libraries. Loads every library in "dev" and "en" languages. After it, checks if the file keys (both files are json at the end) are equals. It uses AsyncSpec libraries for asyncronous specs with Jasmine.
files = [
'a.json',
'b.json',
'c.json'
]
last = 'c.json'
loadFileDev = (name, holder, callback) ->
$.get("locales/dev/#{name}", (data) =>
holder[name] = data
@luiscronicl
luiscronicl / verySimpleCompAndDeploy.sh
Last active December 11, 2015 17:28
Very simple script for do automatic code deploys every time one client.js file generated with toaster is updated
#!/bin/sh
########################################################################################################
### Launches toaster compiler and copies some code to another place every time "client.js" file ###
### (this file is auto-generated with toaster) changes. ###
### requires inotify tools: sudo apt-get install inotify-tools ###
### Font (http://superuser.com/questions/181517/how-to-execute-a-command-whenever-a-file-changes) ###
########################################################################################################
toaster -wcd &