Skip to content

Instantly share code, notes, and snippets.

View seven1m's full-sized avatar

Tim Morgan seven1m

View GitHub Profile
require 'curses'
include Curses
class Editor
LOG = File.open('editor.log', 'w')
def initialize
@x = 1
@y = 1
end
#!/usr/bin/env ruby
STORE="#{ENV['HOME']}/.clipboard-history"
LIMIT=100
require 'timeout'
unless File.exist?(STORE)
File.open(STORE, 'w') { |f| f.write('') }
end

Keybase proof

I hereby claim:

  • I am seven1m on github.
  • I am seven1m (https://keybase.io/seven1m) on keybase.
  • I have a public key whose fingerprint is B446 F96D 0CB5 3366 4D8C 992D 4386 DC2D 12ED 223E

To claim this, I am signing this object:

@seven1m
seven1m / to_rspec.rb
Last active August 29, 2015 14:01
Really dumb script for converting from MiniTest::Unit to RSpec. This will get 80% of the grunt work done for you.
#!/usr/bin/env ruby
# This is a crude script to convert MiniTest::Unit files to RSpec files.
# To use:
#
# cd path/to/your/railsapp
# gem install parser unparser
# ruby to_rspec.rb
# rspec spec --fail-fast
#
@seven1m
seven1m / fix_find_by.rb
Last active August 29, 2015 14:01
Change find_by_ and find_all_by_ AR finder calls to where+first and where+all.
#!/usr/bin/env ruby
# A script to convert old dynamic finder syntax to new where+first and where+all.
# Used to do the grunt work for this PR: https://github.com/churchio/onebody/pull/63
# gem install parser unparser
# cd path/to/rails_app
# ruby fix_find_by.rb
require 'parser/current'
@seven1m
seven1m / PlusOne.user.js
Last active August 29, 2015 14:02
GreaseMonkey (or TamperMonkey) script that adds a +1 button to GitHub Pull Requests. (Click "Raw" to install.)
// ==UserScript==
// @name GitHub Pull Request Enhancements
// @namespace http://tannermar.es
// @version 0.2
// @description Add "Plus One" and "Retest" buttons to PR pages. Automatically add and remove "+1", "+2", and "NOT READY!" labels bast on comment contents. Included on all of github because pushState.
// @include https://github.com/*
// @copyright 2014+, @tannermares
// ==/UserScript==
var emojiPlusOnes = function() {
@seven1m
seven1m / Vagrantfile.local
Created July 5, 2014 16:43
Tweaks to my Vagrantfile for OneBody, to make things run faster
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "2048"]
end
config.vm.network "private_network", type: "dhcp"
config.vm.synced_folder ".", "/vagrant", type: "nfs"
@seven1m
seven1m / fix_find_all.rb
Last active August 29, 2015 14:04
Fix old Rails 1.x finder syntax.
#!/usr/bin/env ruby
# A script to convert old Rails 1.x finder syntax, e.g. find(:all, ...) and find(:first, ...)
# to use where() and friends.
# gem install parser unparser
# cd path/to/rails_app
# ruby fix_find_by.rb
require 'parser/current'
@seven1m
seven1m / test.rb
Last active August 29, 2015 14:05
Bug in ActiveRecord where(...).create() -- see https://github.com/rails/rails/issues/16668
require 'active_record'
require 'sqlite3'
require 'rspec'
ActiveRecord::Base.establish_connection(
adapter: 'sqlite3',
database: ':memory:'
)
ActiveRecord::Base.logger = Logger.new(STDOUT)
@seven1m
seven1m / .watchr
Created June 26, 2015 01:29
.watchr config for watchr/observr
# run the specs when anything changes
watch('.*') do
cmd = IO.popen('rspec spec 2>&1')
print cmd.getc until cmd.eof?
end