Skip to content

Instantly share code, notes, and snippets.

@smerchek
smerchek / find_tables_with_is_removed.sql
Last active July 9, 2019 16:13
Find all tables with a given column name (e.g. `is_removed`)
select t.table_schema,
t.table_name,
CASE WHEN EXISTS(SELECT *
FROM information_schema.columns c
WHERE c.table_name = t.table_name
and c.table_schema = t.table_schema
and c.column_name = t.table_name || '_id'
) THEN '✅' ELSE '❌' END
AS has_matching_id_column,
(SELECT c.column_name

Keybase proof

I hereby claim:

  • I am smerchek on github.
  • I am smerchek (https://keybase.io/smerchek) on keybase.
  • I have a public key ASCbCRQMa6fnJ3sJ14paAMNA63zd95yVF6OBZkXGuQl7Ugo

To claim this, I am signing this object:

@smerchek
smerchek / abbreviations.md
Created August 7, 2015 19:45
Pharmacy Abbreviations
Abbrev Direction
q EVERY
qH EVERY HOUR
qAM EVERY MORNING
qPM EVERY EVENING
qHS EVERY BEDTIME
qD EVERY DAY
qOD EVERY OTHER DAY
qWK EVERY WEEK

Keybase proof

I hereby claim:

  • I am smerchek on github.
  • I am smerchek (https://keybase.io/smerchek) on keybase.
  • I have a public key whose fingerprint is E304 46D8 1409 1FEC 7106 8F61 64AB 9A52 9682 653B

To claim this, I am signing this object:

@smerchek
smerchek / blinky_formatter.rb
Created January 15, 2015 03:44
Blink(1) rspec formatter
require 'rspec'
require 'blinky'
# Usage: rspec --require blink_formatter.rb --format BlinkFormatter
# fix issue where no light will cause lock-up
module Blinky
class LightFactory
class << self
alias :original_detect_lights :detect_lights
@smerchek
smerchek / sum.js
Created January 15, 2014 22:55
Sum the items in an Amazon wish list (inspired by "Total up the cost of all items in an Amazon wishlist" https://gist.github.com/chrismbarr/3230548)
var list = $$("span.a-color-price.a-size-base");
var total=0;
for(i=0; i<list.length;i++){
total += parseFloat(list[i].innerText.replace("$",""));
}
alert(list.length+" items for a total of: $"+total.toFixed(2));
@smerchek
smerchek / codemash_2014.md
Created January 15, 2014 16:49
CodeMash 2014 Highlights/Notes

Putting the D&D in TDD (FULL DAY)

Guy Royse; George Walters

I used Ruby and Minitest with my Blink(1) to TDD through this very big Kata. It was fun and a great learning experience. It did a good job of going slowly at first to get the basics and then ramping up. There is much left that I could do here for further practice.

Sweet Elixir! A Gentle Introduction to Erlang’s cute younger brother Elixir (FULL DAY)

Ryan Cromwell; Chris McCord

@smerchek
smerchek / learning_rails.md
Last active January 2, 2016 18:39
KCDC 2014 Session Proposal

Learning Rails for Fun and Nonprofit

There are a lot of nonprofits that need help building websites. While wordpress may suffice for many of these organizations, some have requirements that are better suited to an actual website. With free/cheap tools like Heroku and other database/logging services, quickly building a website that meets a nonprofit’s needs is very approachable. This is the perfect type project for learning Ruby on Rails.

In this session, Scott will talk about the benefits of using a Nonprofit web project to learn Rails and what he learned while building LoveKC.org. While this is not an in-depth introduction to Rails, expect to learn about various aspects of getting started with Rails like setting up user authentication and roles, geocoding, search with elasticsearch, mailings (Mailchimp and Mandrill), and image upload/manipulation. This is a good equipping session, showing you not only what is possible with Rails, but also how to start the journey yourself.

@smerchek
smerchek / food_permits.csv
Created November 21, 2013 19:36
KCMO Data
We can't make this file beautiful and searchable because it's too large.
Facility Permit #,Establishment Name,Facility Name,Facility Street No.,Facility Street Name,Facility Unit No,Facility City,Facility State,Facility Zip,Business Status,Facility Type,Permit Type,Web Site,Operational Status,Location 1
, Delaware Cafe, Delaware Cafe,300,Delaware,,Kansas City,MISSOURI,64105,Closed,Restaurant/Deli 0-5 Employees,,,Operational,"300 Delaware
Kansas City, MISSOURI 64105
(39.10926928022309, -94.58450117517305)"
,12TH & BALTIMORE,12TH & BALTIMORE,106 W 12TH ST,,Attn: Accounting Department,KANSAS City,MISSOURI,64105,Open,Restaurant/Deli 0-5 Employees,,,Operational,"106 W 12TH ST Attn: Accounting Department
KANSAS City, MISSOURI 64105
(39.103149999772825, -94.58638000023666)"
,135TH ST. B B Q,135TH ST. B B Q,325 E. 135TH ST,,,KANSAS CITY,MISSOURI,64145,Closed,Restaurant/Deli 0-5 Employees,,,Operational,"325 E. 135TH ST
KANSAS CITY, MISSOURI 64145
(38.882631716603704, -94.59216179033736)"
@smerchek
smerchek / windows_installer.pp
Last active October 17, 2016 13:29
Puppet for windows installers at Softek
# This is the basic structure for a Windows project puppet module at Softek
# We found that the Package type as provided by Puppet was not quite sufficient for our needs.
# Instead, we transfer the file, exec msiexec when it changes (while logging install output), and then ensure the service is running.
class some_project {
$installer = 'Project.Setup.msi'
$url = "puppet:///release/${installer}"
file { "c:/packages/${installer}":
ensure => 'file',
mode => '1777',