Skip to content

Instantly share code, notes, and snippets.

@arboleya
arboleya / pvt_access_modifier_cs.coffee
Created August 10, 2012 14:20
Private methods/properties in CoffeeScript.
# PRIVATE METHODS/PROPERTIES - COFFEESCRIPT
# ------------------------------------------------------------------------------
# Simple hack to protect private methods and properties from outside classes,
# all props and methods starting with '_' will be unaccessible from outside.
class AccessModifiers
@for:( scope )->
api = {}
@arboleya
arboleya / compiler.coffee
Created November 22, 2012 11:51
Custom compiling routine using Coffee Toaster under the hood, injecting javascript's HEADER and FOOTER code to you final JS output file.
###
This file replaces your 'toaster.coffee' config file, you'll not need
that anymore since the config is passed to Toaster as a hash/object.
Keep in mind that in order for this to work, you'll have to use toaster
as a dependency, which can be easily achieved putting the provided
'package.json' file in your base dir and running 'npm install' to install
toaster locally. Or just enter your project folder and run
'npm install coffee-toaster' (not recommend but work as well)
@arboleya
arboleya / setup-serpentem-workbench.sh
Last active December 10, 2015 06:08
This gist will setup all the serpentem's repos connected, it incluses `fs-util`, `coffee-toaster`, `theoricus` `and `theoricus-demo-app`. Read all the code and comments to be apart everything.
# Basic configs
USER='serpentem'
NPM='sudo npm'
# Initializes the repo (cloning, remotes, etc)
function clone()
{
repo=$1
remotes=$2
npmlink=$3
@arboleya
arboleya / ns.js
Last active December 10, 2015 17:08 — forked from giuliandrimba/namespace.js
Simple namespace definer.
/*
USAGE:
# at window
ns( 'my.namespace' ).MyClass = ...
# at app obj
var app = {}
ns( 'my.namespace', app ).MyClass = ...
*/
@arboleya
arboleya / microevent.coffee
Last active December 11, 2015 01:08
MicroEvent in CoffeeScript.
###
Port of MicroEvent in Coffeescript with some naming modifications
and a new 'once' method.
Original project:
https://github.com/jeromeetienne/microevent.js
###
class MicroEvent
_init:-> @_listn or @_listn = {}
_create:(e)-> @_init()[e] or @_init()[e] = []
@arboleya
arboleya / polvo-skel
Last active December 24, 2015 16:09
Simple shell script to scaffold a very simple app skeleton to be built using Polvo.
#!/bin/sh
# NOTES:
# - This script takes only one argument (desired path to create the app)
# - It uses uses coffeescript, stylus and jade to as sample files/code
# - Its intended to be just an example for getting started, and nothing more
# - For more info on Polvo, check the project Site and README:
# http://polvo.io
# https://github.com/polvo/polvo