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
require 'redis'
def long_running_command
t = Thread.new do
conn = Redis.new
conn.client.call(["DEBUG", "SLEEP", "1"])
end
sleep 0.1 # let it connect before we return
t
end
1367380560 3862477.333333
1367380620 3876914.666667
1367380680 3839693.333333
1367380740 3852773.333333
1367380800 3827573.333333
1367380860 3827392.000000
1367380920 3827498.666667
1367380980 3827685.333333
1367381040 3824862.666667
1367381100 3814248.000000
1367380380 3852840.000000
1367380440 3889616.000000
1367380500 3857600.000000
1367380560 3862477.333333
1367380620 3876914.666667
1367380680 3839693.333333
1367380740 3852773.333333
1367380800 3827573.333333
1367380860 3827392.000000
1367380920 3827498.666667
ּ_בּ
בּ_בּ
טּ_טּ
כּ‗כּ
לּ_לּ
מּ_מּ
סּ_סּ
תּ_תּ
٩(×̯×)۶
٩(̾●̮̮̃̾•̃̾)۶
@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"
@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 / 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 / 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]%}⚡"

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"
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