Skip to content

Instantly share code, notes, and snippets.

@xsurge83
xsurge83 / gist:5663582
Created May 28, 2013 15:26
UserWebApiCache
WebApi = require('../../repositories/classic/data/webApi')
_ = require('underscore')
UserWebApiCache = (webApi)->
this.innerWebApi = webApi
_.extend(@, webApi)
UserWebApiCache::post = (url, body, callback)->
logger.info 'post [url] body %j', url, body
start = Date.now()
var FancyController, Injector, LogController, FirstGreeter, OtherGreeter, SomeController, WelcomeController, logController, someController;
Injector = {
/*
* {name, object, selfDeps}
*/
dependencies: {},
parseArgs: function(target) {
var FN_ARG, FN_ARGS, FN_ARG_SPLIT, STRIP_COMMENTS, args, text;
@xsurge83
xsurge83 / interfacesImpl.js
Last active December 16, 2015 22:29
Interfaces and Implementation
var UserRepo = {
get: function(id){}
save: function(user){}
};
var UserRepoImpl1 = function(...){
}
UserRepoImpl1.prototype = Object.create(UserRepo);
# Module pattern with cached functions
FooFunction = ->
log "foo"
BarFunction = ->
log "bar"
Klass3 = ->
foo: FooFunction
bar: BarFunction
@xsurge83
xsurge83 / oop.coffee
Last active December 16, 2015 02:09
OOP Private and Public Member
MyClass= ->
prVar = 'private'
prMethod1 = ->
console.log 'prMethod'
self.pubMethod2()
public_members =
pubVar : 'public'
pubMethod1: ->
console.log 'pubMethod1'
@xsurge83
xsurge83 / gist:5351458
Created April 10, 2013 03:12
one liner : add to array
(r || (r = [])).push('d')
@xsurge83
xsurge83 / mapView
Last active December 14, 2015 18:09
Google Maps View
(function(exports, $) {
var MapView;
MapView = (function() {
function MapView(mapId, defaultLocation, map) {
self = this;
var location = BrowserUtils.getParamFromQuery('query');
if (!location) {
@xsurge83
xsurge83 / gist:5032128
Last active December 14, 2015 04:59
Private and public methods
class MyClass2
self = 'default'
console.log 'invoked once invoke me once per load'
constructor: ->
my21 = new MyClass2();
my22 = new MyClass2();
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="stylesheet" href="http://cmx.io/v/0.1/cmx.css"/>
<script src="http://cmx.io/v/0.1/cmx.js"></script>
<body>
<scene id="scene1">
<label t="translate(0,346)">
<tspan x="0" y="0em">Miami Life</tspan>
</label>
<actor t="translate(131,49)" pose="-11,9|-5,117|-11,99|-11,89|-11,79|-11,59|-16,34|-21,9|-6,34|-1,9|-18,79|-18,59|-6,79|-1,59">
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="stylesheet" href="http://cmx.io/v/0.1/cmx.css"/>
<script src="http://cmx.io/v/0.1/cmx.js"></script>
<body>
<scene id="scene1">
<label t="translate(0,346)">
<tspan x="0" y="0em">Kay's Life</tspan>
</label>
<actor t="translate(131,49)" pose="-11,9|-5,117|-11,99|-11,89|-11,79|-11,59|-16,34|-21,9|-6,34|-1,9|-18,79|-18,59|-6,79|-1,59">