Skip to content

Instantly share code, notes, and snippets.

Avatar
🙌
good times

Adam Bachman abachman

🙌
good times
View GitHub Profile
View deacronym.rb
#!/bin/env ruby
# Usage:
#
# $ deacronym ASDF
# Attracted Shrinking Development Finish
#
# You'll need your own copy of Seasoning of Wood by J.B. Wagner
# http://www.gutenberg.org/ebooks/26598
@abachman
abachman / Error: Invalid value for HOMEBREW_CC.md
Created Nov 18, 2014
Error: Invalid value for HOMEBREW_CC
View Error: Invalid value for HOMEBREW_CC.md

Note to self:

If you run into "Error: Invalid value for HOMEBREW_CC" while trying to install things with homebrew on Mac OS X, make sure you don't have export HOMEBREW_CC=something in your ~/.bashrc file.

@abachman
abachman / remover.rb
Created Nov 22, 2014
selectively filtering word lists
View remover.rb
require 'readline'
list1 = ARGV[0]
list2 = ARGV[1]
badwords = File.readlines(list1).map(&:strip)
words = File.readlines(list2).map(&:strip)
puts "remove #{ list1 } #{badwords.size} words from #{ list2 } #{ words.size }"
@abachman
abachman / application.js
Last active Aug 29, 2015
My Fitness Pal
View application.js
throw Error("Closure::Error: Exception in thread \"main\" java.lang.UnsupportedClassVersionError: com/google/javascript/jscomp/CommandLineRunner : Unsupported major.minor version 51.0\n\tat java.lang.ClassLoader.defineClass1(Native Method)\n\tat java.lang.ClassLoader.defineClass(ClassLoader.java:643)\n\tat java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)\n\tat java.net.URLClassLoader.defineClass(URLClassLoader.java:277)\n\tat java.net.URLClassLoader.access$000(URLClassLoader.java:73)\n\tat java.net.URLClassLoader$1.run(URLClassLoader.java:212)\n\tat java.security.AccessController.doPrivileged(Native Method)\n\tat java.net.URLClassLoader.findClass(URLClassLoader.java:205)\n\tat java.lang.ClassLoader.loadClass(ClassLoader.java:323)\n\tat sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)\n\tat java.lang.ClassLoader.loadClass(ClassLoader.java:268)\nCould not find the main class: com.google.javascript.jscomp.CommandLineRunner. Program will exit.\n\n (in /mnt/deploy/apps/staged/M
@abachman
abachman / gist:77142
Created Mar 10, 2009
Take a look at all the models in your project and find out how they're related.
View gist:77142
require 'rubygems'
require 'railroad/models_diagram'
require 'railroad/options_struct'
options = OptionsStruct.new
options.parse = ['--verbose']
mod = ModelsDiagram.new options
mod.generate
mod.graph.nodes.each do |node|
View models_and_the_models_they_love
require 'rubygems'
require 'railroad/models_diagram'
require 'railroad/options_struct'
options = OptionsStruct.new
options.parse = ['--verbose']
mod = ModelsDiagram.new options
mod.generate
mod.graph.nodes.each do |node|
@abachman
abachman / gist:79949
Created Mar 16, 2009
multi-env rake command for rails projects
View gist:79949
#!/bin/bash
#
# For example, you're deep in prototyping mode, and want to keep your test
# and development environments in sync. Don't keep typing:
# rake RAILS_ENV=test db:migrate && rake RAILS_ENV=development db:migrate
# instead:
# rakes -dt db:migrate
#
# don't repeat yourself.
View gist:82386
# drop in your ~/.bashrc file. guaranteed to "works on my machine".
#
# Go straight to the root of the current rails project.
# example:
# ~/workspace/proj/app/models $ rr
# going to /home/user/workspace/proj
# ~/workspace/proj $
#
# /etc/init.d/ $ rr
# /etc/init.d/ $
@abachman
abachman / metaclass-demo.rb
Created Apr 16, 2009
Demonstration of a handful of the metaprogramming features of Ruby.
View metaclass-demo.rb
# Demonstration of a handful of the metaprogramming features of Ruby.
#
# This code uses the same class/module configuration as Rails' standard
# acts_as plugins. I was looking for a way to extend the behavior of an
# ActiveRecord model in practice, and this came out of that exploration.
#
# Each "method" of extending the target class is tested and evaluated
# for functionality and a report is printed.
#
# Each method is tested as a class method and an instance method,
View gist:111061
// ==UserScript==
// @name Kill Uservoice
// @namespace adam_bachman
// @description Kill Uservoice Tab
// @include *
// ==/UserScript==
(function () {
var uservoice_tab = document.getElementById("uservoice-feedback-tab");
if (uservoice_tab) {
You can’t perform that action at this time.