Skip to content

Instantly share code, notes, and snippets.

View kmckelvin's full-sized avatar

Kevin McKelvin kmckelvin

View GitHub Profile

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@kmckelvin
kmckelvin / Dockerfile
Last active February 11, 2018 11:32
Multiple base images when building
FROM golang:1.9.4 AS build
WORKDIR /go/src/github.com/kmckelvin/app
COPY . .
RUN go test ./...
RUN CGO_ENABLED=0 go build -a -installsuffix cgo -o /app main.go
FROM scratch
COPY --from=build /app /
ENV PORT 80
@kmckelvin
kmckelvin / bittrex-watch.js
Created August 14, 2017 09:46
Gives some insights into bitcoin markets from Bittrex stats
const fetch = require('node-fetch');
const chalk = require('chalk');
const term = require('terminal-kit').terminal;
const fs = require('fs'),
path = require('path');
const timestamp = () => new Date().toLocaleTimeString();
const getMarketValue = market =>
@kmckelvin
kmckelvin / emoji.js
Last active August 9, 2017 14:03
Turn the emoji spec at http://www.unicode.org/Public/emoji/6.0/emoji-data.txt into a regular expression
const fs = require('fs');
const notCommented = str => str.trim().length && str.trim()[0] !== '#';
const notASCII = str => !str.startsWith('00');
const ranges = str => str.substr(0, str.indexOf(' '));
const isRange = str => str.indexOf('..') !== -1;
const firstRange = str => str.substr(0, str.indexOf('..'));
const secondRange = str => str.substr(str.indexOf('..') + 2);
const esc = str => `\\u{${str}}`;
const rangeToRegex = str => `[${esc(firstRange(str))}-${esc(secondRange(str))}]`;
@kmckelvin
kmckelvin / Gemfile
Created February 9, 2016 20:46
Flattens arbitrarily nested arrays
source "https://rubygems.org"
gem 'rspec'
@kmckelvin
kmckelvin / 5 key metrics.md
Last active May 22, 2018 07:21
Brief explanation of 5 key metrics in software projects

5 Key Metrics of software projects

Rough draft - 2015-08-25

  • Burndown rate (not velocity)
  • Rejection rate
  • Defect (bug) rate
  • Ratio of lines of test:lines of code >= 2:1
  • Volatility
@kmckelvin
kmckelvin / gist:7138622
Created October 24, 2013 14:49
Base config for tmuxinator
# ~/.tmuxinator/base.yml
name: base
root: ~/Code/<project_dir>
# Optional tmux socket
# socket_name: foo
# Runs before everything. Use it to start daemons etc.
pre: rm .zeus.sock
@kmckelvin
kmckelvin / README.md
Created November 11, 2012 17:21
Converts OpenSong song files to OnSong format

Usage

Pretty easy to use - just make sure that Ruby is installed, then run this:

ruby opensong_to_onsong.rb ./path_to_opensong_file.xml > ./export_filename.txt

It just outputs straight to STDIO.

@kmckelvin
kmckelvin / timed_formatter.rb
Created March 18, 2012 09:55
RSpec formatter with timed outputs
require 'rspec/core/formatters/documentation_formatter'
class TimedFormatter < RSpec::Core::Formatters::DocumentationFormatter
def example_passed(example)
output.puts "#{passed_output(example)} - #{example.execution_result[:run_time]}"
end
def example_failed(example)
output.puts "#{failure_output(example, example.execution_result[:exception])} - #{example.execution_result[:run_time]}"
end
@kmckelvin
kmckelvin / gist:1871125
Created February 20, 2012 20:12 — forked from jeriko/gist:1865932
KICKSTART v1
class AppBuilder < Rails::AppBuilder
include Thor::Actions
include Thor::Shell
# Express app templating for Rails
# ------------------------------------
# USAGE:
# 1. Add gems to `gem_dependencies`
# 2. Methods listed in SCRIPTS will be run after bundling, so make sure they each have a declaration
# 3. run: `rails new app_name --builder=path/to/builder.rb` (URI's work here too)