Skip to content

Instantly share code, notes, and snippets.

View NigelThorne's full-sized avatar

Nigel Thorne NigelThorne

View GitHub Profile
@NigelThorne
NigelThorne / dump_qc_to_folder.rb
Last active April 17, 2018 12:42
Runs on Windows. Assumes you have QC installed. The code needs some love, but does work.
$:.unshift File.expand_path(File.dirname(__FILE__))
require 'win32ole'
require 'qc_automation'
require 'qc_test'
require 'fileutils'
module QCIntegration
class TestFolder
attr_accessor :kids
@NigelThorne
NigelThorne / hash_inverse.rb
Last active October 25, 2017 05:43
ruby hash invert
require './hash_inverse'
describe Hash do
describe "when empty and asked for the inverse" do
it "returns an empty hash" do
{}.inverse.must_equal Hash.new
end
end
describe "when mapping are unique and asked for the inverse" do
@NigelThorne
NigelThorne / compare.rb
Last active January 16, 2017 05:48
AdHoc Scripts to compare regex files and look for strings that were not translated correctly.
if(ARGV.count < 2)
puts "Usage: #{__FILE__} file1.resx file2.resx"
exit -1
end
if(`gem list`.scan(/nokogiri/).count == 0)
puts "You need to install nokogiri. Type 'gem install nokogiri' at a command prompt"
exit -1
end
@NigelThorne
NigelThorne / scan.rb
Last active December 20, 2016 01:31
Scan log files and track number of subscribers over time. (for dumping into excel)
# Run through all zip files to get log files
# Process log files => events
# Process events => (event + initial_state) => new_state => to state stream
#
require 'rubygems'
require 'zip'
def has_arg(arg)
ARGV.include? arg
end
text = ARGV[0]
lines = text.scan(/.{0,40}(?:\b|$)/).map{|l| l.strip }
lines = (lines[-1] == "" ? lines[0...-1] : lines)
longest = lines.map{|l| l.length}.max
lines.map!{|l| l+ (" " * (longest - l.length))}
@NigelThorne
NigelThorne / print_jiras.rb
Created August 12, 2016 14:02
Print Jira to cards
require 'rubygems'
require 'jira-ruby'
require 'slim'
# args [name, pass, projectid]
def get_jira_client()
options = {
:username => ARGV[0],
:password => ARGV[1],
@NigelThorne
NigelThorne / howto-manually-add-trust-cert-to-rubygems.md
Last active April 9, 2016 06:37
Workaround RubyGems' SSL errors on Ruby for Windows (RubyInstaller)

SSL upgrades on rubygems.org and RubyInstaller versions

UPDATE 2014-12-21: RubyGems 1.8.30, 2.0.15 and 2.2.3 have been released. It requires manual installation, please see instructions below.


Hello,

If you reached this page, means you've hit this SSL error when trying to

@NigelThorne
NigelThorne / Gemfile
Last active March 4, 2016 06:23
AutoHotKey_L script to TTS the currently selected text.
source "http://rubygems.org"
gem "eventmachine", "1.0.8"
gem "thin"
gem "win32-service"
gem "sinatra"
@NigelThorne
NigelThorne / ConsoleHere.reg
Created March 3, 2016 02:25
WIndows: Open Console2 console in current location context menu
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\Console2]
@="Console Here"
[HKEY_CLASSES_ROOT\Directory\shell\Console2\command]
@="C:\\ProgramData\\chocolatey\\bin\\Console.exe"
[HKEY_CLASSES_ROOT\Directory\Background\shell\Console2]
@="Console Here"
[HKEY_CLASSES_ROOT\Directory\Background\shell\Console2\command]
@="C:\\ProgramData\\chocolatey\\bin\\Console.exe"
@NigelThorne
NigelThorne / overlay_ESRB_in_Steam.js
Last active January 28, 2016 12:44
Add ESRB ratings icons to steam store. I used the "Control Freak" chrome extension to add the following script. Add a script for http://http://store.steampowered.com/ pasting the text below Add Jquery 2.0.2 (http://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js) in the Libs section. Reload http://store.steampowered.com/
$(".tab_desc h4").each(function(e){
var self = $(this);
var game = $(this).text().split(" ").join("+");
// var data = {
// titleOrPublisher: self.text(),
// isIncluding: false,
// rating: "",
// ratingsCriteria: "",
// platforms: "",