Skip to content

Instantly share code, notes, and snippets.

View arsduo's full-sized avatar

Alex Koppel arsduo

View GitHub Profile
logging_dbg=> explain verbose select id from logging_table where message = 'unit_started' limit 1;
QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------------------------------------------
Limit (cost=0.70..4.72 rows=1 width=4)
Output: id
-> Index Scan using index_logging_table_on_message_date_org on public.logging_table (cost=0.70..2190640.79 rows=545232 width=4)
Output: id
Index Cond: ((logging_table.message)::text = 'unit_started'::text)
(5 rows)
@arsduo
arsduo / description.md
Last active September 15, 2015 03:13
Maven build failures for Markovian

I'm attempting to build a jar that will work with AWS Lambda (for kicks). In theory, Maven should pull all the gems via the Torquebox proxy and compile a jar file for me. However, for some reason it's failing on a gem dependency issue -- it seems to be pulling an old version of the Twitter gem's depencency http.

(I've never done work with jruby before, so I'm learning as I go.)

The repo is here: https://github.com/arsduo/markovian-lambda/tree/lambda-jar

pom.xml: https://github.com/arsduo/markovian-lambda/blob/lambda-jar/pom.xml

Here's the end result of mvn package:

@arsduo
arsduo / jar contents
Last active September 17, 2015 22:52
Figuring out how to access classes in a JRuby jar
META-INF/
META-INF/MANIFEST.MF
markovian-lambda/
markovian-lambda/lambda.rb
markovian-lambda/lambda_runner.rb
markovian-lambda/tweeter.rb
markovian-lambda/twitter_config.rb
markovian-lambda/version.rb
META-INF/maven/
META-INF/maven/markovian.lambda/
@arsduo
arsduo / Gemfile
Created March 30, 2016 14:55
Reproduction of RSpec issue with double used in raised errors
source "https://rubygems.org"
gem "rspec", ">= 3.5.0.beta2"
@arsduo
arsduo / chicago-fringe-scraper.js
Last active August 27, 2016 19:59
2016 Chicago Fringe Schedule Scraper
// a simple, quick script to gather data for the 2016 Chicago Fringe Festival in a spreadsheet-compatible format
// see https://www.amazon.com/s/ref=sr_st_review-rank?rh=n%3A172282%2Cn%3A!493964%2Cn%3A541966%2Cn%3A172456%2Cn%3A11548951011%2Cn%3A172471%2Cp_n_feature_three_browse-bin%3A6208468011%2Cp_85%3A2470955011%2Cp_72%3A1248879011%2Cp_36%3A-10000&qid=1472326383&bbn=172471&sort=review-rank
// you can paste these into your console and run them
function getChicagoFringeShows() {
let tables = document.getElementsByClassName("schedule");
let shows = {};
for (let i = 0; i < tables.length; i++) {
let table = tables[i];
// the last table is empty
@arsduo
arsduo / check_changed_coverage.rb
Last active June 9, 2023 19:10
SimpleCov Test Coverage for Files Changed in a Branch
output = `cat #{ENV["CIRCLE_ARTIFACTS"] || "."}/coverage/index.html | grep Changed -A 2 | grep "[0-9\.]*%"`
percentage_match = output.match(/([0-9\.]+)%/)
raise "Unable to determine test coverage change" unless percentage_match
RED = "\033[0;31m"
BOLD = "\033[1m"
NO_COLOR = "\033[0m"
percentage = percentage_match[0].to_f
@arsduo
arsduo / Dockerfile
Last active June 16, 2017 14:59
How does it even work? The Elm+Elixir Starter Kit supporting materials
# ...other steps...
# Install Elm
ADD ./elm/elm-package.json ./elm/elm-package.json
WORKDIR /usr/src/app/elm
RUN yarn global add elm \
&& elm-package install -y
WORKDIR /usr/src/app
# Install Phoenix and other Elixir packages
@arsduo
arsduo / historyExportFunction.js
Last active April 9, 2018 21:07
Examples for the ElmRings Blog Post
handleHistoryExport(event) {
const target = event.target;
// see if we're downloading data from Elm 0.18.x
// assuming that the history export format won't change in a patch version 🤞
if (target.href && unescape(target.href).match(/{"elm":0.18/)) {
// Elm delivers the data in the format
// 'data:' + mime + ',' + encodeURIComponent(jsonString));
const historyData = unescape(target.href.split(/,/)[1]);
// you'll generally want to handle this data in Javascript, since nothing good would likely come from
@arsduo
arsduo / installingElmRings.sh
Last active April 9, 2018 21:16
ElmRings blog post - example 3
yarn add elm-rings
# or
npm install elm-rings
@arsduo
arsduo / triggerHistoryExport.js
Last active April 9, 2018 21:06
ElmRings Blog Post - example 2
triggerHistoryExport() {
const exportButton = this.containerElement.querySelectorAll(
".elm-mini-controls-import-export span"
)[1];
if (!exportButton) {
return;
}
const oldAllow = this.allowDownload;