Skip to content

Instantly share code, notes, and snippets.

View seven1m's full-sized avatar

Tim Morgan seven1m

View GitHub Profile

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:

#!/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
require 'curses'
include Curses
class Editor
LOG = File.open('editor.log', 'w')
def initialize
@x = 1
@y = 1
end
require 'httparty'
require 'ostruct'
class Issue < OpenStruct
include HTTParty
base_uri 'https://vitals.atlassian.net/rest/api/2'
USER = 'JIRA_USER'
PASS = 'JIRA_PASSWORD'
PROJECT = 'Consumer Websites'
@seven1m
seven1m / .watchr
Last active December 18, 2015 22:38
Watchr config for Rails app using Test::Unit.
LINUX = RUBY_PLATFORM =~ /linux/i unless defined?(LINUX)
def escape(arg)
arg.gsub(/\e\[..m?/, '') # rid us of ansi escape sequences
.gsub(/["`]/, "'")
.gsub(/\r?\n/, "\\\\\\\\\\n")
end
def notify(pass, heading, body='')
cmd = if LINUX
@seven1m
seven1m / name.py
Last active December 18, 2015 16:09
A Python function and a String-based class for capitalizing a proper name. There are a handful of tests; save the snippet to a .py file and run it from a terminal.
# -*- coding: iso-8859-1 -*-
# The code here is based loosely on John Cardinal's notes found at:
# http://www.johncardinal.com/tmgutil/capitalizenames.htm
# 2006-03-16
# Thanks to David Kern <kernd@reasonspace.com> for fixing some bugs.
suffixes = "II|(II)|III|(III)|IV|(IV)|VI|(VI)|VII|(VII)|2nd|(2nd)|3rd|(3rd)|4th|(4th)|5th|(5th)".split('|')

Note: this is an old old list that I once hosted on my website circa 2005. I keep it around just to reminisce. :-)

This is a list of JavaScript libraries I've noticed while cruising the Web.

Modern

@seven1m
seven1m / download_posterous_assets.rb
Created April 26, 2013 20:41
Reads in source files in a Jekyll blog that were imported from a Posterous blog and: 1) downloads Posterous-hosted assets locally and 2) replaces URLs with local ones.
require 'open-uri'
URL = /https?:\/\/getfile\d*\.posterous\.com[^"]*/
posts = Dir['source/_posts/*'].to_a
posts.each do |path|
post = File.read(path)
post.gsub!(URL).each do |url|
data = open(url).read
name = File.split(url).last
@seven1m
seven1m / broke.rb
Last active December 16, 2015 07:29 — forked from bayleedev/broke.rb
class Foo
class << self
private
def bar
puts 'I did not broke your ruby'
end
end
end
Foo.bar # NoMethodError: private method `bar' called for Foo:Class