Skip to content

Instantly share code, notes, and snippets.

View thephw's full-sized avatar
❤️
Building software with love

Patrick Howard Wiseman thephw

❤️
Building software with love
View GitHub Profile
movie_names = File.read('/Users/patrickwiseman/Desktop/movie_names.txt').split("\n")
movies = movie_names.map do |movie_name|
JSON.parse(Net::HTTP.get(URI("http://www.omdbapi.com/?t=#{movie_name}&y=&plot=short&r=json")))
end
movies = movies.sort_by{|m| m["imdbRating"].to_i}.reverse
File.write('/Users/patrickwiseman/Desktop/movies.json', movies.to_json)
'.source.ruby, .source.ruby.rails':
'Bang Logger':
prefix: 'bang'
body: 'Rails.logger.debug "#{\'=\'*100}\\\\n$1"'

Relentlessly Gay™

Each method takes in a set of hue lights and an option set of other parameters for desired visual effect.

Basic setup

Optionally set export HUE_USERNAME=3N70R9-kFFVm-L2GvVOOEpXdDV6Th4yCUsdLrmcb if you know your username already. Otherwise you have to go click the sync button.

require 'hue'
require_relative "./hue_pride.rb"
@thephw
thephw / example.md
Last active February 4, 2016 17:36
Automaton girl - leveraging factory girl for QA data

Set your vars

email = "patrick.wiseman@salesloft.com"
user = User.find_by(email: email)
account = user.account
team = account.team
@thephw
thephw / merge_tool_basics.sh
Created January 18, 2016 19:58
Please use your merge tool
# Setup your merge tool
$ git config --global merge.tool opendiff
# Use your merge tool when you have conflicts
$ git mergetool
# Cleanup after your merge (delete .orig files)
$ find . -name "*.orig" -delete
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@thephw
thephw / one_line_ruby_server.rb
Created December 9, 2013 14:13
One line ruby server
ruby -run -e httpd . -p5000
@thephw
thephw / mens_roller_derby.geojson
Last active December 29, 2015 01:49
Men's Roller Derby Teams
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@thephw
thephw / model_snippet.rb
Created November 8, 2013 16:40
My weird way of not rewriting all of the json for to_json and to_indexed_json
# ...
# Helper Function
def index_content
require 'open-uri'
if self.content.present? && self.content.url.present? && self.content.url.downcase.ends_with?("pdf")
uri = URI.join HOSTNAME, self.content.url
io = open(uri)
reader = PDF::Reader.new(io)
reader.pages.collect(&:text).join
end
rubocop_happy = $(rubocop -a)
if [ "$rubocop_happy" != "true" ]
then
cat <<\EOF
Error: Rubocop detected style conflicts, commit cancelled, please review.
EOF
exit 1
fi