Skip to content

Instantly share code, notes, and snippets.

View tysonmote's full-sized avatar
🤠
code cowboy

Tyson Mote tysonmote

🤠
code cowboy
View GitHub Profile
@tysonmote
tysonmote / gist:1185149
Created September 1, 2011 00:53
Find images that aren't referenced at all in a folder's code
`find /Users/tyson/project/images/`.split("\n").each do |path|
file = path.split("/").last
next if file.empty? || file == ".DS_Store"
result = `ack '#{file.gsub(".", "\\.")}' /Users/tyson/project`
puts path if result.empty?
end
@tysonmote
tysonmote / gist:1644948
Created January 20, 2012 03:57
TextMate 2 Bundle Editor crash
Removing "<string>￿</string>" causes this language grammar to no longer crash TextMate 2 when
attempting to edit it in the bundle editor.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>fileTypes</key>
<array>
<string>_spec.coffee</string>
//= require mootools
//= require handlebars
//= require metamorph
//= require rickshaw/Rickshaw
//= require rickshaw/Rickshaw.Model
//= require rickshaw/Rickshaw.List
//= require rickshaw/Rickshaw.Controllers
//= require rickshaw/Rickshaw.Handlebars
//= require rickshaw/Rickshaw.Metamorph
//= require socket-router
5/8/12 12:07:47.986 PM Marked: Custom processor is available
5/8/12 12:07:47.988 PM Marked: Initial load from baseURL
5/8/12 12:07:47.988 PM Marked: Loading
5/8/12 12:07:47.989 PM Marked: README.md opened with encoding 4
5/8/12 12:07:48.066 PM Marked: Using custom processor
5/8/12 12:07:48.067 PM Marked: Launching render task
5/8/12 12:07:48.229 PM Marked: Custom Processor Finished
5/8/12 12:07:48.270 PM Marked: Done loading from baseURL
5/8/12 12:07:48.319 PM Marked: Loading
5/8/12 12:07:48.319 PM Marked: README.md opened with encoding 4

Her Build Status Gem dependency status

Her is an ORM (Object Relational Mapper) that maps REST resources to Ruby objects. It is designed to build applications that are powered by a RESTful API instead of a database.

Installation

In your Gemfile, add:

gem "her"
@tysonmote
tysonmote / tyson.zsh-theme
Created December 31, 2012 19:26
My ZSH theme, adapted from various other places.
# Append the current git branch, if in a git repository
local location="%{$fg[cyan]%}%~\$(git_prompt_info)%{$reset_color%}"
# Use a % for normal users and a # for privelaged (root) users.
local prompt="%{$fg[magenta]%}%(!.#.%%)%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[white]%} %{$fg[green]%}["
ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN=" %{$fg[green]%}√"
ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[green]%}⚡"
@tysonmote
tysonmote / gist:4567655
Created January 18, 2013 19:33
How to suppress all exceptions without a `rescue` clause.
def bad
raise 'oops'
end
def try
result = yield
ensure
return result
end
@tysonmote
tysonmote / HandlebarsViews.coffee
Created March 1, 2013 19:13
Some helper classes to make rendering Backbone views less of a pain in the ass. SimpleSpin and SmallError are custom classses -- you'll have to implement them yourself.
#
# Backbone.HandlebarsView
# =======================
#
# HandlebarsView is a Backbone.View class that renders Handlebars templates.
# HandlebarsView handles nested subviews. Currently, HandlebarsView doesn't do
# piecemeal re-rendering. When render() is called, it re-renders all subviews,
# as well.
#
@tysonmote
tysonmote / Redis Commands.rb
Last active December 14, 2015 19:38
This bit of Ruby gives you the canonical Redis command groupings in JavaScript (or JSON, if you prefer) directly from redis.io.
require 'mechanize'
require 'json'
commands = {}
groups = {}
groupLabels = {}
groupOrder = []
page = Mechanize.new.get "http://redis.io/commands"
ּ_בּ
בּ_בּ
טּ_טּ
כּ‗כּ
לּ_לּ
מּ_מּ
סּ_סּ
תּ_תּ
٩(×̯×)۶
٩(̾●̮̮̃̾•̃̾)۶