Skip to content

Instantly share code, notes, and snippets.

View matthewfinnell's full-sized avatar

Matt F matthewfinnell

  • Seattle, WA
  • 03:25 (UTC -07:00)
View GitHub Profile
@matthewfinnell
matthewfinnell / Fix_Invalid_Byte_Sequences_in_UTF8_in_one_col_csv
Created May 7, 2020 00:04
How to fix "invalid byte sequence in UTF-8" errors when uploading data to ActionNetwork.org
outty_boy = File.open("output.csv", "w")
File.open("#{ARGV[0]}").each do |row|
row.encode!("UTF-8", row.encoding, undef: :replace, invalid: :replace, replace: "")
outty_boy << row
end
outty_boy.close
@matthewfinnell
matthewfinnell / MergeAllSheets
Created August 9, 2014 19:22
Google Apps Script to merge all data from multiple sheets into a single sheet for reporting on Google Drive Sheets.
/* MergeAllSheets
*
* Takes a list of sheet names and add their data to a single sheet
* Uses leftmost col. for names of the orginiating sheet of ea. row
* If no args specified, takes all sheets except current - reports count
*
* Always assumes header row (doesn't take row 1 of anything)
*
* Usage:
* =MergeAllSheets("D.C.","Illinois","Los Angeles","Massachusetts","Ohio","Seattle")
@matthewfinnell
matthewfinnell / InfaltionMinWageAreaChart.js
Created June 26, 2012 20:05
Google Graph API Showing Minimum Wage Vs Inflation Adjusted Minimum Wage
function drawVisualization() {
// Some raw data
var data = google.visualization.arrayToDataTable([
['Year', 'Minimum Wage', 'Minimum Wage With Inflation Indexing'],
['1968', 1.60, 1.6],
['1974', 2.00, 2.27],
['1975', 2.10, 2.47],
['1976', 2.30, 2.62],
['1979', 2.90, 3.34],
['1980', 3.10, 3.79],