Skip to content

Instantly share code, notes, and snippets.

View sandinmyjoints's full-sized avatar
🏠
Working from home

William Bert sandinmyjoints

🏠
Working from home
View GitHub Profile
@debrouwere
debrouwere / gist:809993
Created February 3, 2011 19:20
Nested resources in django-tastypie
from sandbox import models
from tastypie import fields
from apibase.resources import CamayakModelResource
from django.conf.urls.defaults import url
class ModelResource(CamayakModelResource):
def override_urls(self):
urls = []
for name, field in self.fields.items():
# $ brew install https://raw.github.com/gist/1121425/rubberband.rb
require 'formula'
class Rubberband < Formula
homepage ''
url 'http://code.breakfastquay.com/attachments/download/35/rubberband-1.8.1-gpl-executable-osx-universal.tar.bz2'
version '1.8.1'
sha1 'bceba7dba8cdd773a318ca973ed9c5806be03262'
@lazywithclass
lazywithclass / gist:1582626
Created January 9, 2012 11:50
TDD functions for emacs
(global-set-key (kbd "C-c C-r") 'run-mocha)
(defun run-mocha()
"Runs all the tests in the current buffer"
(interactive)
(let* (command result exit-value)
(setq command (concat "mocha -r should " (buffer-name)))
(setq exit-value (shell-command command))
(color-modeline exit-value)))
@ryan-roemer
ryan-roemer / server-cluster.coffee
Created September 6, 2012 13:56
Node.js v0.8 Cluster Server
cluster = require "cluster"
log = require "winston"
config = require "config" # Your configuration goes here.
app = require "./server" # Your real server goes here.
numCpus = require("os").cpus().length
workers = {}
# Helpers.
shutdown = ->
@sandinmyjoints
sandinmyjoints / init.el
Created September 18, 2012 15:55
Emacs init.el
;; -*- lexical-binding: t -*-
;;;; init.el
;;;; See: https://gist.github.com/3743892
;;; TODO:
;;; * Coffee-script etags.
;;; * Coffee-script compile and flymake.
;;; * swank.js:
;;; * https://github.com/Gozala/swank-js
@nicholascloud
nicholascloud / blog-npm-root-packages.md
Last active December 16, 2015 03:49
blog-npm-root-packages

The problem

When I list my npm packages with npm ls -g (or without the -g option for a local node_modules directory) I see all installed packages and their dependencies. Like so:

$ npm ls -g
├─┬ anvil.js@0.9.0-RC3.1
│ ├── colors@0.6.0
│ ├─┬ commander@1.1.1
│ │ └── keypress@0.1.0
@BinaryMuse
BinaryMuse / phantom.coffee
Created April 13, 2012 18:33
Take screenshots with Phantom.js from Node.js
#!/usr/bin/env coffee
# Call the program with: coffee phantom.coffee http://url.to/screengrab
phantom = require 'phantom' # npm install phantom
child_process = require 'child_process'
url = process.argv[2]
createScreenshot = (page, filename) ->
@eliperelman
eliperelman / LICENSE.txt
Created June 20, 2011 16:53 — forked from 140bytes/LICENSE.txt
String.prototype.trim polyfill for 140byt.es
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Eli Perelman http://eliperelman.com
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@ericelliott
ericelliott / eslint-configs.md
Last active January 20, 2017 08:36
ESLint configs

In search of Idiomatic ESLint

I'm in the process of creating a new web app boilerplate, and I need to give it a lint config. Kyle Simpson convinced me I should look at ESLint instead of JSHint, so now I have to figure out how to configure ESLint to my liking. My liking means as idiomatic as possible.

To that end, I will give an unnamed JavaScript related prize (of real value) to the person who can show me an .eslintrc that most closely matches the idiomatic style I recommend in Appendix A of "Programming JavaScript Applications" (O'Reilly).

Candidates

@nanek
nanek / gist:f7f8f4cfd76751e43dd1
Created May 20, 2015 20:46
Disable npm install on ElasticBeanstalk. Only npm rebuild.
commands:
01_fixNpmInstallJustRebuild:
command: sed -i "s/check_call(\[npm_path, 'install'\], cwd=app_path, env=npm_env)/#/g" /opt/elasticbeanstalk/containerfiles/ebnode.py
02_fixNpmInstallJustRebuild:
command: sed -i "s/check_call(\[npm_path, '--production', 'install'\], cwd=app_path, env=npm_env)/#/g" /opt/elasticbeanstalk/containerfiles/ebnode.py