Skip to content

Instantly share code, notes, and snippets.

View mattjmorrison's full-sized avatar

Matthew J Morrison mattjmorrison

View GitHub Profile
@mattjmorrison
mattjmorrison / epicfail.txt
Created December 23, 2012 19:15
Trying to figure out how to use r.js freaking deleted everything (including .git) in my cwd!
(emberdemo)[emberdemo] node_modules/requirejs/bin/r.js -o baseUrl=. name=main ☁ master ☀
Error: Missing either an "out" or "dir" config value. If using "appDir" for a full project optimization, use "dir". If you want to optimize to one file, use "out".
at Function.build.createConfig (/Users/mattjmorrison/Projects/emberdemo/node_modules/requirejs/bin/r.js:22707:19)
(emberdemo)[emberdemo] node_modules/requirejs/bin/r.js -o baseUrl=. name=main dir=. ☁ master ☀
Error: ENOENT, no such file or directory
at Object.exports.resolve (path.js:284:52)
(emberdemo)[emberdemo] node_modules/requirejs/bin/r.js -o baseUrl=. name=main out=main.js
zsh: no such file or directory: node_modules/requirejs/bin/r.js
@mattjmorrison
mattjmorrison / .emacs
Created December 7, 2012 04:43
Emacs Config
(add-to-list 'load-path "~/.emacs.d/plugins")
(require 'color-theme)
(color-theme-initialize)
(color-theme-midnight)
(set-face-attribute 'default nil :height 130)
(add-to-list 'load-path "~/.emacs.d/vendor")
(load-file "~/.emacs.d/emacs-for-python/epy-init.el")
(require `tramp)
(load-file "~/.emacs.d/emacs-for-python/epy-pylint.el")
(load-file "~/.emacs.d/emacs-for-python/epy-flake8.el")
@mattjmorrison
mattjmorrison / default
Created December 3, 2012 13:17
nginx config
server {
listen 80;
}
server {
listen 80;
server_name python.sample.com;
location / {
auth_basic "Restricted";
auth_basic_user_file htpasswd;
@mattjmorrison
mattjmorrison / Gemfile
Created June 22, 2012 01:58
Dynamic Thor Group
source 'https://rubygems.org'
gem 'thor'
@mattjmorrison
mattjmorrison / sample.rb
Created June 22, 2012 00:43
How the crap do I use define_method in a module? -- needs "self.included"
module SampleMod
def self.included(base)
[:one, :two, :three].each do |method_name|
define_method method_name do
puts "inside #{method_name}"
end
end
end
@mattjmorrison
mattjmorrison / autoworkon.sh
Created April 15, 2012 23:02
@toranb's Automatically 'workon' a virtualenv
# This makes 3 assumptions
# 1.) the root project directory must have a .git file (this way it won't try to "workon" in every single
# directory on your machine)
# 2.) the virtualenv name for your project must match the root directory name of your project
# 3.) you want it to auto switch virtualenvs for you when you jump between different project directories
# (when you hit another dir w/ a virtualenv that is)
workon_virtualenv() {
if [ -e .git ]; then
current_dir="${PWD##*/}"
@mattjmorrison
mattjmorrison / first_grade.py
Created April 8, 2012 16:53
Inherit Tests Cases
class FirstGradeMath(object):
def __init__(self, first_number, second_number):
self.first_number = first_number
self.second_number = second_number
def add(self):
return self.first_number + self.second_number
def subtract(self):
@mattjmorrison
mattjmorrison / 0_install.sh
Created April 7, 2012 13:22
Python Dependency Management: Part 2
sudo pip install virtualenv
@mattjmorrison
mattjmorrison / fake_oo.js
Created April 4, 2012 13:11
JavaScript: Roll your own OO
jQuery.noConflict();
MyClass = function($){
return function(val){
console.log("Constructing MyClass Instance");
var self = {};
self.getVal = function(){
return self.val;
};
self.val = val;
@mattjmorrison
mattjmorrison / oo.py
Created April 4, 2012 13:05
Python: Roll your own OO
def Module():
module_state = {}
def Class(val):
def get_val():
return val
class_state = {'get_val': get_val}
return class_state