Skip to content

Instantly share code, notes, and snippets.

View justinperkins's full-sized avatar
🥶

Justin Perkins justinperkins

🥶
View GitHub Profile
# Use builtin Image Events app in Mac OS X to resize images with Ruby
# Usage:
# require 'image_resizer'
# class Foo
# include ImageResizer
# def some_method
# resize('/absolute/path/to/an/image.jpg')
# resize('/absolute/path/to/an/image.jpg', :target_width => 500)
# end
# end
require 'hpricot'
require 'open-uri'
class AmazonMp3Music
ASSOCIATE_ID = 'enjoybeing-20'
AMAZON_INJECTED_STRINGS = [' (Amazon Exclusive)', ' [Explicit]']
attr_accessor :asin, :artist, :album, :album_image, :referral_url, :processed
def initialize(url)
@url = url
#!/usr/bin/env ruby
# The script that give you focus!
# Create a text file that contains sites you only want to give yourself
# access to during certain times of day.
# The file will look like this:
# 12 news.ycombinator.com
# 11-13,19-21 twitter.com
#
# In this case, I can visit hacker news only over the lunch hour,