Skip to content

Instantly share code, notes, and snippets.

View jrhorn424's full-sized avatar
🌟
Always be dreaming

Jeffrey Horn jrhorn424

🌟
Always be dreaming
View GitHub Profile
@jrhorn424
jrhorn424 / hack.sh
Created March 31, 2012 22:35 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# Modified to suit my preferences by jrhorn424
# http://github.com/jrhorn424
#
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
@jrhorn424
jrhorn424 / install-ruby-with-doc
Last active December 22, 2015 05:39
Install ruby with documentation using `rbenv install`
env CONFIGURE_OPTS="--with-readline-dir=`brew --prefix readline` --enable-install-doc --enable-install-rdoc" rbenv install 2.0.0-p247
# First, copy your settings over
ActionMailer::Base.smtp_settings = {
:address => "smtp.mandrillapp.com",
:port => 587,
:domain => "ices-experiments.org",
:user_name => Settings.mandrill_user,
:password => Settings.mandrill_password,
:authentication => "login"
}
@jrhorn424
jrhorn424 / routes.rb
Created November 11, 2013 00:08
Goal: have semi-static pages with a crud interface at root of application.
FormtasticBootstrap3::Application.routes.draw do
resources :pages, path: '/'
end
# Check this into the features that have different schemas as you develop
# Before you merge to master you either comment this out or remove the file
export DATABASE_NAME=cool_story_bro
@jrhorn424
jrhorn424 / _readme.md
Created November 16, 2013 04:59 — forked from mislav/_readme.md

I use tmux splits (panes). Inside one of these panes there's a Vim process, and it has its own splits (windows).

In Vim I have key bindings C-h/j/k/l set to switch windows in the given direction. (Vim default mappings for windows switching are the same, but prefixed with C-W.) I'd like to use the same keystrokes for switching tmux panes.

An extra goal that I've solved with a dirty hack is to toggle between last active panes with C-\.

Here's how it should work:

@jrhorn424
jrhorn424 / Fastmail-commented.plist
Last active February 20, 2016 14:53
Fastmail keybindings for MailMate
#####################################################################################################
### WARNING: not kept up to date. I don't know the format well, and comments were causing issues. ###
### See next file for up-to-date mappings. ###
#####################################################################################################
{
// Keybindings to emulate Fastmail shortcuts in MailMate
// From: http://fastmail.wikia.com/wiki/KeyboardShortcuts
// Created by Jeffrey Horn <hello@jrhorn.me>
// See: http://manual.mailmate-app.com/key_binding_selectors
class Article < ActiveRecord::Base
def self.states(*states)
states.each do |state|
define_method "#{state}?" do
self.state == state
end
define_singleton_method "all_#{state}" do
where("state = ?", state)
{
n = "nextMessage:";
p = "previousMessage:";
j = "nextThread:";
k = "previousThread:";
o = "openMessages:";
"\n" = "openMessages:";
"\n" = "openMessages:";
y = "archive:";
m = "moveToMailbox:";
# MOTIVATION: As rails apps are growing, people are noticing the drawbacks
# of the ActiveRecord pattern. Several apps I have seen, and several
# developers I have spoken to are looking towards other patterns for object
# persistence. The major drawback with ActiveRecord is that the notion
# of the domain object is conflated with what it means to store/retrieve
# it in any given format (like sql, json, key/value, etc).
#
# This is an attempt to codify the Repository pattern in a way that would
# feel comfortable to beginner and seasoned Ruby developers alike.
#