This file contains hidden or 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
| $.fn.grid = (interval) -> { | |
| var canvas = @[0], context = canvas.getContext('2d') | |
| x = y = 0.5 | |
| while((x+=interval)<canvas.width) { | |
| context.moveTo(x,0) | |
| context.lineTo(x,canvas.height) | |
| } | |
| while((y+=interval)<canvas.height) { | |
| context.moveTo(0,y) | |
| context.lineTo(canvas.width,y) |
This file contains hidden or 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
| // include the following | |
| .notifier | |
| img.progressor(src='/progressor.gif') | |
| span.message loading fonts and stuff ... |
This file contains hidden or 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
| var kaffeine = new (require("kaffeine"))(); | |
| app.register('.k', { | |
| compile: function(str, options) { | |
| return function(locals) { return uglify(kaffeine.compile(str)) }; | |
| } | |
| }); | |
| function uglify(js) { | |
| var jsp = require("uglify-js").parser; |
This file contains hidden or 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
| data = | |
| init: () -> | |
| data.emptyDB "animals", () -> | |
| console.log "ready" | |
| # now populate your new DB | |
| emptyDB: (name, done) -> | |
| db = new(cradle.Connection)().database(name); | |
| db.exists (err, exists) -> |
This file contains hidden or 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
| "underscore,connect,express,redis,sys,coffee-script,fs" | |
| .split(',').forEach (lib) -> global[lib] = require lib | |
| # make macros if you like | |
| _ = underscore |
This file contains hidden or 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
| function calc() { | |
| var sum = 0; | |
| $('.profile_list_table > tbody > tr > td:nth-child(2) div div').each(function() { | |
| console.log(this, this.innerHTML); | |
| sum+=parseInt(this.innerHTML.replace(',','')) | |
| }); | |
| $('.account_table_header_text').append(' [Total: '+sum+']'); | |
| } | |
| setTimeout(calc,3000); |
This file contains hidden or 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
| winston = require 'winston' | |
| global[level] = winston[level] for level of winston.config.syslog.levels | |
| debug 'foo' | |
| info 'foo' | |
| notice 'foo' | |
| warning 'foo' | |
| error 'foo' | |
| crit 'foo' | |
| alert 'foo' |
This file contains hidden or 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
| function jader { | |
| scalate tojade $1 | sed 's/" /",/g' > `basename $1 .html`.jade | |
| } | |
| ### PRE-REQUISITE: scalate (e.g. "brew install scalate") |
This file contains hidden or 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://stackoverflow.com/questions/3404508/cross-browsers-mult-lines-text-overflow-with-ellipsis-appended-within-a-widthhei/3880955#3880955 | |
| $.fn.ellipsize = (maxHeight) -> | |
| i=100 # prevent infinite loop | |
| $(this).each () -> | |
| $this = $(this) | |
| while (--i and $this.outerHeight()>50) | |
| $this.text (index, text) -> text.replace /\W*\s(\S)*$/, '...' |
This file contains hidden or 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
| templates = {} | |
| $ () -> | |
| $('.template').each (i,el) -> templates[el.id.replace('Template','')] = _.template(el.innerHTML) | |
| .... | |
| # LATER ON, HERE IS HOW WE USE THE TEMPLATE ... | |
| .... | |
| $('.storyContainer').html templates.story | |
| title: 'holy crazy!' |