Skip to content

Instantly share code, notes, and snippets.

View jmazzi's full-sized avatar

Justin Mazzi jmazzi

View GitHub Profile
@jmazzi
jmazzi / longif.rb
Created January 4, 2012 15:30 — forked from pstengel/longif.rb
Format this nicely plz
empty_filters = (args[:reseller_filter].empty? && args[:user_filter].empty?)
owner_filter = args[:reseller_filter].include?(u['owner'])
user_filter = args[:user_filter].include?(u['user'])
if empty_filters || (owner_filter || user_filter)
class OnePassword
DATA = File.read("#{ENV['HOME']}/Desktop/1Password.txt")
def self.passwords
return @passwords if @passwords
data = DATA.dup.lines.to_a.map { |line| line.strip.split("\t") }
header = data.shift
@passwords = data.map {|line| Hash[header.zip(line)]}
end
@jmazzi
jmazzi / Questions
Created July 13, 2011 12:08
Magma Rails Give-away
Day Job:
Open Source contribution (if any):
Tell me about your experience with Ruby/Rails:
How do you use GitHub:
Favorite luchador(es):
var SALister;
SALister = (function() {
function SALister() {}
SALister.prototype.loadList = function(what, o) {
var callParams, success, _o;
what = what.toLowerCase();
_o = {
regex: null,
container: what + 'List',
pagStart: null,
required = [
:i,
:city,
:region,
:postal,
:country,
:license_key
]
optional = [
~ ➔ ruby -rpsych -ryaml -e 'YAML.load("[:year]")'
/Users/headius/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/psych.rb:148:in `parse': couldn't parse YAML at line 1 column 0 (Psych::SyntaxError)
from /Users/headius/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/psych.rb:148:in `parse_stream'
from /Users/headius/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/psych.rb:119:in `parse'
from /Users/headius/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/psych.rb:106:in `load'
from -e:1:in `<main>'
~ ➔ ruby -ryaml -e 'YAML.load("[:year]")'
@jmazzi
jmazzi / gist:981240
Created May 19, 2011 17:07 — forked from sdeming/gist:981231
spec_helper.rb, patch for using transactions with Sequel
class Spec::Example::ExampleGroup
def execute(*args, &block)
DB.transaction do
begin
super(*args, &block);
ensure
raise Sequel::Error::Rollback
end
end
end
@jmazzi
jmazzi / gist:793544
Created January 24, 2011 17:15 — forked from luk-/gist:792961
root@huckleberry [~]# vim --version
VIM - Vi IMproved 7.0 (2006 May 7, compiled Sep 9 2010 18:43:42)
Included patches: 1, 3-4, 7-9, 11, 13-17, 19-26, 29-31, 34-44, 47, 50-56, 58-64, 66-73, 75, 77-92, 94-107, 109, 202, 234-237
Modified by <[email protected]>
Compiled by <[email protected]>
Huge version without GUI. Features included (+) or not (-):
+arabic +autocmd -balloon_eval -browse ++builtin_terms +byte_offset +cindent
-clientserver -clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments
+cryptv +cscope +cursorshape +dialog_con +diff +digraphs -dnd -ebcdic
+emacs_tags +eval +ex_extra +extra_search +farsi +file_in_path +find_in_path
~/projects/jruby ➔ ls lib/ruby/gems/1.8/gems/ | wc -l
471
~/projects/jruby ➔ time jruby -rubygems -e 1
real 0m5.079s
user 0m7.375s
sys 0m0.393s
~/projects/jruby ➔ git stash pop --quiet
#!/usr/bin/env ruby
def output_config
puts <<-END
graph_category App
graph_title Passenger memory stats
graph_vlabel count
memory.label memory
END