Skip to content

Instantly share code, notes, and snippets.

View monokrome's full-sized avatar
😻
meow

Bailey Stoner monokrome

😻
meow
View GitHub Profile
module.exports =
plugins:
# NOTE: This was renamed to jaded, and does not contain a
# separate "jade" object inside of it. Jaded will be smart
# and just filter out what it needs before passing the rest
# to jade itself.
jade:
globals:
accessKey: process.env.ENV_ACCESS_KEY or 'default'
@monokrome
monokrome / models.py
Last active December 25, 2015 15:09
Reverse relations in TastyPie
from django.db import models
class NamedModel(models.Model):
class Meta(object):
abstract = True
name = models.CharField(max_length=16)
def __unicode__(self):
return self.name
@monokrome
monokrome / README.md
Created October 12, 2013 19:50 — forked from nikcub/README.md
@monokrome
monokrome / editors.js
Last active December 25, 2015 07:29
Test providing example of why https://github.com/powmedia/backbone-forms/pull/301 solves a problem.
test("'renderOptions' passes a Model's id to setValue", function () {
var fakeModel = new Backbone.Model({ id: '/example/id/' }),
FakeCollection = new Backbone.Collection([fakeModel]),
field = new editor({ options: FakeCollection }),
spy = this.sinon.stub(field, 'setValue');
field.render();
ok(spy.calledOnce);
ok(spy.calledWith(fakeModel.id));
@monokrome
monokrome / pre-commit
Last active December 25, 2015 03:39 — forked from fearofcode/pre-commit
#!/usr/bin/env sh
# rename pre-commit.sample in the hooks directory to pre-commit and replace its content with this
set_traces=`git grep ".set_trace()"`
if [ ! -z "$set_traces" ] ; then
echo "You have pdb.set_trace() in your code! Commit aborted!"
echo $set_traces
exit 1
{
"jenkins": {
"protocol": "https",
"auth": "user:password",
"host": "jenkins.example.com"
},
"deploy": {
"directory": "/home/deployment/bin/",
"commands": [
@monokrome
monokrome / marionette-sorted.coffee
Created September 2, 2013 08:50
Sorted views for Marionette in CoffeeScript
class SortedView
appendHtml: (collectionView, itemView, index) ->
if collectionView.itemViewContainer?
childrenContainer = collectionView.$ collectionView.itemViewContainer
else
childrenContainer = collectionView.$el
children = childrenContainer.children()
if children.size() <= index
class MyModel extends Backbone.Model
toString: ->
return 'my model'
class ExampleApplication extends Marionette.ApplianceManager
appliances: [
'example'
]
module.exports = {ExampleApplication}
@monokrome
monokrome / nginx.sh
Created August 12, 2013 21:58
Run homebrew nginx more easily
#!/usr/bin/env sh
fail() {
echo "Failed to authenticate as superuser."
exit
}
# Verify that
test sudo || fail