Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View linus-amg's full-sized avatar

Linus Gubenis linus-amg

  • Mexico, Berlin
  • 07:23 (UTC -06:00)
View GitHub Profile
@linus-amg
linus-amg / index.js
Created October 21, 2015 18:26 — forked from max-mapper/index.js
requirebin sketch
var inherits = require('inherits');
var Game = require('crtrdg-gameloop');
var Entity = require('crtrdg-entity');
var Keyboard = require('crtrdg-keyboard');
inherits(Player, Entity);
function Player(options){
this.position = {
x: options.position.x,
@linus-amg
linus-amg / index.coffee
Created August 30, 2015 00:04
behaviorsLookup
Marionette.Behaviors.behaviorsLookup = ->
return window.Behaviors = {}
@linus-amg
linus-amg / itemview.coffee
Created August 30, 2015 00:04
use the behavior
class RowView extends Marionette.ItemView
tagName: 'tr'
template: require './row.hbs'
behaviors:
Socket: true
@linus-amg
linus-amg / behavior.coffee
Created August 30, 2015 00:03
the behavior
class window.Behaviors.Socket extends Marionette.Behavior
onRender: ->
console.log 'asd'
@linus-amg
linus-amg / gist:e3201b0dd7e8a78cbabd
Created August 28, 2015 17:48
workaround optimization killers
var errorObject = {value: null};
function tryCatch(fn, ctx, args) {
try {
return fn.apply(ctx, args);
}
catch(e) {
errorObject.value = e;
return errorObject;
}
}
@linus-amg
linus-amg / utils.coffee
Last active August 29, 2015 01:57
new Date() .time() .unix_timestamp() and Number.pad() methods !!
Number::pad = (len) ->
return (new Array(len + 1).join('0') + @).slice(-len)
Date::time = ->
returnValue = ''
returnValue += @getHours().pad(2) + ':'
returnValue += @getMinutes().pad(2) + ':'
returnValue += @getSeconds().pad(2)
return returnValue
window.App = new Marionette.Application
initialize: ->
@layout = new Layout()
onStart: ->
@layout.render()
@region = @layout.getRegion('main')
onStop: (options) ->
@region.empty()
stop: (options) ->
if @onStop
@collection.fetch().done =>
@layout.getRegion('main').show new ListView
collection: @collection
@linus-amg
linus-amg / status.coffee
Created August 21, 2015 17:26
nodegit get status
Git = require('nodegit')
pathToRepo = require('path').resolve(process.cwd())
module.exports = (socket, options) ->
Git.Repository.open(pathToRepo)
.then(getStatus)
.then (list) ->
console.log list
getStatus = (repository) ->
@linus-amg
linus-amg / start
Created August 18, 2015 15:24
nohup node sudo grunt dev start
#!/bin/sh
nohup sudo node index.js >/dev/null 2>&1 &
nohup grunt >/dev/null 2>&1 &