Skip to content

Instantly share code, notes, and snippets.

View cheshire137's full-sized avatar

Sarah Vessels cheshire137

View GitHub Profile
@cheshire137
cheshire137 / git-cherry-pick-shas.js
Created September 24, 2015 22:01
Get cherry-pick commands for shas linked on a Github page
// 1. Go to a URL like https://github.com/my-org/my-repo/pull/1/commits
// 2. Open up your browser JavaScript console.
// 3. Paste the command below.
// Now you have git cherry-pick commands for making a branch of those commits!
var commands = '';jQuery('a.sha').each(function() { var url = $(this).attr('href'); var sha = url.split('/commit/')[1]; commands += 'git cherry-pick ' + sha + "\n"; }); console.log(jQuery.trim(commands));
@cheshire137
cheshire137 / ronaldchase.rb
Created September 10, 2015 14:51
What does 'rc' stand for in all those .*rc files anyway? Why not Ronald Chase?
#!/usr/bin/env ruby
require 'fileutils'
path = File.expand_path('~/.*rc')
Dir[path].each do |file|
next unless File.file?(file)
destination = file.gsub(/rc$/, 'ronaldchase')
puts "#{file} -> #{destination}"
FileUtils.ln_s(file, destination)
@cheshire137
cheshire137 / rss_fetcher.rb
Created June 28, 2015 16:50
Delicious and Pocket RSS to JSON
#!/usr/bin/env ruby
# encoding: utf-8
require 'rubygems'
# require 'nokogiri'
require 'json'
require 'rss'
require 'open-uri'
require 'uri'
class RSSFetcher
@cheshire137
cheshire137 / steam.rb
Created October 19, 2014 22:45
Get Steam player details, recently played games
#!/usr/bin/env ruby
# encoding: utf-8
require 'rubygems'
require 'json'
require 'open-uri'
class SteamAPI
attr_reader :api_key, :user_id, :api_url
def initialize api_key, user_id, api_url=nil
@cheshire137
cheshire137 / my_class_spec.rb
Last active August 29, 2015 14:00
VCR cassettes relative to the current describe/context block
require 'spec_helper'
module Module1
describe Module2::MyClass do
let(:my_instance) { Module1::Module2::MyClass.new('abc', 123) }
context 'super cool context' do
# Use cassette Module1_Module2_MyClass/super_cool_context/neat_method.yml
describe 'neat_method', vcr: relative_cassette('neat_method') do
subject { my_instance.neat_method(id) }