Skip to content

Instantly share code, notes, and snippets.

View linus-amg's full-sized avatar

Linus Gubenis linus-amg

  • Mexico, Berlin
  • 20:10 (UTC -06:00)
View GitHub Profile
window.App = new Marionette.Application
initialize: ->
@layout = new Layout()
onStart: ->
@layout.render()
@region = @layout.getRegion('main')
onStop: (options) ->
@region.empty()
stop: (options) ->
if @onStop
# Thanks to this post:
# http://blog.ikato.com/post/15675823000/how-to-install-consolas-font-on-mac-os-x
$ brew install cabextract
$ cd ~/Downloads
$ mkdir consolas
$ cd consolas
$ curl -O http://download.microsoft.com/download/f/5/a/f5a3df76-d856-4a61-a6bd-722f52a5be26/PowerPointViewer.exe
$ cabextract PowerPointViewer.exe
$ cabextract ppviewer.cab
@linus-amg
linus-amg / ref.js
Created November 5, 2015 19:03
ref
function ref(obj, str) {
str = str.split(".");
for (var i = 0; i < str.length; i++)
obj = obj[str[i]];
return obj;
}
var obj = { a: { b: 1, c : { d : 3, e : 4}, f: 5 } }
str = 'a.c.d'
ref(obj, str) // 3
@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'
@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 &