Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am xdissent on github.
  • I am xdissent (https://keybase.io/xdissent) on keybase.
  • I have a public key ASCgQUIr6Puf0Zfaj0HP4c2XTgbeNQXOWoNdROZAVQtmYAo

To claim this, I am signing this object:

@xdissent
xdissent / install.sh
Created January 31, 2015 01:09
Slic3r dev on Yosemite
brew update
brew install wxmac
curl -L http://search.cpan.org/CPAN/authors/id/H/HA/HAARG/local-lib-2.000015.tar.gz | tar -zxC ~/src
cd ~/src/local-lib-2.000015
perl Makefile.PL --bootstrap
make install
echo 'source (perl -I$HOME/perl5/lib/perl5 -Mlocal::lib | psub)' >> ~/.config/fish/config.fish
source ~/.config/fish/config.fish
cpan App::cpanminus
cpanm --configure-args="--wxWidgets-build=0" Alien::wxWidgets
@xdissent
xdissent / errors.coffee
Created May 27, 2014 16:03
Extendable native Error subclasses in Coffeescript
ok = (ok) -> console.log if ok then 'ok' else 'FAIL'
FnError = (message) ->
@name = 'FnError'
@message = message
@stack = (new Error).stack
FnError:: = new Error
@xdissent
xdissent / initctl2dot
Created November 11, 2013 18:30
initctl2dot with starting/stopping/started/stopped labels for jobs
#! /usr/bin/python3
# -*- coding: utf-8 -*-
#---------------------------------------------------------------------
#
# Copyright © 2011 Canonical Ltd.
#
# Author: James Hunt <james.hunt@canonical.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2, as
@xdissent
xdissent / angular-ctrl.coffee
Last active December 18, 2015 00:39
AngularJS Controllers with Class in Coffeescript http://plnkr.co/rEYMsS0rKo1ZC6O5LoxM
class AngularCtrl
# The namespace to use for module name generation
@ns: 'ns.controllers'
# Module name for the exported Angular module, or autogenerated if `null`
@module: null
# An array of module names required by the controller
@require: []
@xdissent
xdissent / gist:2860403
Created June 2, 2012 23:02
Ember-data hasMany computed properties test
test("filtered property on hasMany assoctiation", function() {
var File = DS.Model.extend({
primaryKey: 'name',
name: DS.attr('string'),
status: DS.attr('string')
});
var Project = DS.Model.extend({
primaryKey: 'name',
@xdissent
xdissent / ataritech-collectd.diff
Created June 23, 2011 19:48
My changes to ataritech's collectd cookbook
diff -r atari/collectd/definitions/collectd_plugin.rb cookbooks/collectd/definitions/collectd_plugin.rb
25c25
< if params[:template].blank?
---
> if params[:template].nil? || params[:template].empty?
diff -r atari/collectd/metadata.rb cookbooks/collectd/metadata.rb
7c7,12
< supports "ubuntu"
---
>
@xdissent
xdissent / post-receive
Created June 20, 2011 21:41
Git post-receive hook to update Redmine changesets
#!/bin/sh
# Add this hook to /usr/share/git-core/templates/hooks to enable for all new repositories.
REPO_URL=`echo $PWD | sed 's:/hooks$::'` /usr/share/redmine/script/runner /usr/share/redmine/extra/update_repository.rb -e production > /dev/null 2>&1 &
@xdissent
xdissent / questionmarks.js
Created January 19, 2011 21:10
Wrap question marks in headers with span in jQuery 1.4+
$('h1, h2').html(function(i, h) {
return h.replace(/\?/g, '<span class="question-mark">?</span>');
});
@xdissent
xdissent / middleware.rb
Created December 8, 2010 05:25
delete vagrant vm's chef client and node from chef server on destroy
class OnDestroyMiddleware
def initialize(app, env)
@app = app
end
def call(env)
`knife client show #{env["config"].chef.node_name}`
if $?.to_i == 0
env.ui.info "Removing client #{env["config"].chef.node_name}"
`knife client delete #{env["config"].chef.node_name} -y`