Skip to content

Instantly share code, notes, and snippets.

View lleger's full-sized avatar

Logan Leger lleger

View GitHub Profile
<?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>Label</key>
<string>org.redis.redis-server</string>
<key>Program</key>
<string>/usr/local/redis/bin/redis-server</string>
<key>ProgramArguments</key>
@lleger
lleger / wp.rb
Created December 12, 2011 17:04
Ruby XMLRPC (Wordpress) Example
require 'xmlrpc/client'
require 'pp'
class XMLRPC::Client
def set_debug
@http.set_debug_output($stderr);
end
end
module XMLRPCWorkAround
@lleger
lleger / Rails Migrations Post Merge Git Commit Hook
Created January 14, 2012 08:07 — forked from eddorre/Rails Migrations Post Merge Git Commit Hook
Rails Migrations Post Merge Git Commit Hook
Get notifications when there are migrations that need to be run in a Rails project:
https://img.skitch.com/20110418-c9y3ttap3tai7frc43f38qtb8e.jpg
In your Rails project edit the .git/config file to add the following:
[rails]
automigrate = false
automigrateforegroundcolor = yellow
automigratebackgroundcolor = black
@lleger
lleger / searchable.rb
Created June 22, 2013 05:00
**Simple Searchable Concern** To use, simply drop this in `app/models/concerns`, include it in the model you want to search (`include Searchable`) and declare which fields are searchable with `searchable_on`. The query currently performed is a simple conjoined `ilike`, but it could be easily extended to more robust queries.
module Searchable
extend ActiveSupport::Concern
included do
cattr_accessor :_searchable_fields
end
module ClassMethods
def searchable_on(*fields)
self._searchable_fields = fields
@lleger
lleger / gist:6942932
Created October 11, 2013 22:21
Commands to make a .gif from a video
ffmpeg -i movie.mov -vf scale=640:-1 -r 10 frames/ffout%03d.png
convert -delay 1x15 -loop 0 frames/ffout*.png -ordered-dither o8x8,8 -coalesce -layers OptimizeTransparency +map output.gif
gifsicle --optimize=3 --delay=3 output.gif -o output_optimized.gif
@lleger
lleger / invoices.js
Created October 22, 2013 00:27
Open Harvest invoices in new tabs
// Pop this into the console to open Harvest invoices in new tabs
var invoices = document.getElementsByClassName('clickable-on');
for(i = 0; i < invoices.length; i++) {
window.open(invoices[i].getAttribute('data-clickable-href'), '_blank');
}
@lleger
lleger / subscription.rb
Created October 28, 2013 04:27
**Simple Stripe Subscription Concern** To use, simply drop this in `app/models/concerns`, include it in the model you want to search (`include Subscription`) and declare the `plan_for_stripe` and `description_for_stripe` helper methods. Use `save_with_payment` in place of `save` when creating a new resource with billing details; similarly, use `…
module Subscription
extend ActiveSupport::Concern
included do
attr_accessor :billing_card_token
end
def save_with_payment
if valid?
customer = ::Stripe::Customer.create(email: email,

Metro Council Members,

By now I’m sure you’ve already seen the news from Shreveport’s council meeting last night where they passed the Fairness Ordinance alongside their annual budget. The Fairness Ordinance prevents discrimination in housing, employment and public spaces against their fellow citizens in the lesbian, gay, bisexual and transgender community. It was an important step forward for their city and passed 6-1. As you know, Louisiana doesn’t have any protections at the state level for these members of our community, so it’s important to codify it on the local level. In doing this last night, they join New Orleans as the only other city in Louisiana to have any sort of LGBTQ anti-discrimination legislation.

The Human Rights Campaign recently released report cards rating cities in America on municipal equality. If you haven’t yet seen them, I encourage you to; the scores released were quite shocking. New Orleans scored a whopping 91/100 (and HRC considers them an all-star). Shreveport scored a 16—and

@lleger
lleger / gist:4390d9f42a57984dc6d5
Created May 12, 2015 23:23
AR serialize json stacktrace
TypeError: no implicit conversion of Hash into String
from /Users/loganleger/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/json-1.8.2/lib/json/common.rb:155:in `initialize'
from /Users/loganleger/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/json-1.8.2/lib/json/common.rb:155:in `new'
from /Users/loganleger/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/json-1.8.2/lib/json/common.rb:155:in `parse'
from /Users/loganleger/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/json/decoding.rb:26:in `decode'
from /Users/loganleger/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activerecord-4.2.1/lib/active_record/coders/json.rb:9:in `load'
from /Users/loganleger/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activerecord-4.2.1/lib/active_record/type/serialized.rb:19:in `type_cast_from_database'
from /Users/loganleger/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activerecord-4.2.1/lib/active_record/type/mutable.rb:5:in `type_cast_from_user'
from /Users/loganleger/.rbenv/v
# better copy and past
bind-key -t vi-copy v begin-selection
bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
unbind -t vi-copy Enter
bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"
# improve colors
set -g default-terminal 'screen-256color'