Skip to content

Instantly share code, notes, and snippets.

View linus-amg's full-sized avatar

Linus Gubenis linus-amg

  • Mexico, Berlin
  • 23:07 (UTC -06:00)
View GitHub Profile
class Marionette.ItemViewService extends Marionette.ItemView
constructor: (options) ->
_.extend @, new Marionette.Service
return Marionette.ItemView.call(this, options)
drool = require('drool')
assert = require('assert')
driver = drool.start
chromeOptions: 'no-sandbox'
drool.flow({
repeatCount: 5
setup: ->
driver.get('http://localhost:3000')
class Behaviors.Scrollspy extends Marionette.Behavior
initialize: (options) ->
@options.onEnter = options.onEnter
@options.onLeave = options.onLeave
@options.container = options.container or @options.container
return
onDomRefresh: ->
$el = @view.$el
@linus-amg
linus-amg / test.js
Created August 18, 2015 12:51
baboom config
}(this), define("../bower_components/requirejs/require", function() {}), requirejs.config({
baseUrl: "https://static.baboom.com/d/prod/src",
paths: {
mout: "../bower_components/mout/src",
"events-emitter": "../bower_components/events-emitter/src",
address: "../bower_components/address/src",
text: "../bower_components/requirejs-text/text",
json: "../bower_components/requirejs-plugins/src/json",
has: "../bower_components/has/has",
jquery: "../bower_components/jquery/dist/jquery",
@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 &
@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) ->
@collection.fetch().done =>
@layout.getRegion('main').show new ListView
collection: @collection
window.App = new Marionette.Application
initialize: ->
@layout = new Layout()
onStart: ->
@layout.render()
@region = @layout.getRegion('main')
onStop: (options) ->
@region.empty()
stop: (options) ->
if @onStop
@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
@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;
}
}