Skip to content

Instantly share code, notes, and snippets.

Avatar

Andy O'Neill werkshy

View GitHub Profile
@werkshy
werkshy / .yamllint
Created Jun 25, 2018
Yamllint Config Example
View .yamllint
extends: default
rules:
comments:
min-spaces-from-content: 1
indentation:
spaces: 2
line-length:
max: 120
View worker.swift
#!/usr/bin/swift
//
// work.swift
//
//
// Created by Andy O'Neill on 4/20/17.
//
//
View a.rb
context "With Barlteby turned on" do
# TODO Get rid of NA tests and test single sku regions only when regionalization complete,
# check sku on VP instead of business region sku as well.
context "With a North American Viewable Product" do
- scenario "Lets you successfuly edit both associated skus and other fields" do
+ scenario "Lets you successfully edit both associated skus and other fields" do
+ t0 = Time.now
allow(BartlebyMode).to receive(:mode) { "full" }
viewable_product = FactoryGirl.create(:viewable_product, :bartleby_mode_full)
@werkshy
werkshy / .gitconfig
Created Sep 15, 2016
Git aliases for ~/.gitconfig
View .gitconfig
[alias]
s = status
st = status # svn muscle memory
stat = status # svn muscle memory
co = checkout # svn muscle memory
cp = cherry-pick # svn muscle memory
fp = push --force-with-lease # prevents force push if there's new commits on master
lol = log --pretty=oneline --abbrev-commit --graph --decorate # compact log format
recent-branches = !"git for-each-ref --sort=-committerdate refs/heads/ | head" # show recent branches
list-merged = !"git branch --merged | grep -v '\\*' | grep -v master | xargs -n 1" # list branches that are merged into master
View git-publish-branch
#!/usr/bin/env ruby
## git-publish-branch: a simple script to ease the unnecessarily complex
## task of "publishing" a branch, i.e., taking a local branch, creating a
## reference to it on a remote repo, and setting up the local branch to
## track the remote one, all in one go. you can even delete that remote
## reference.
##
## Usage: git publish-branch [-d] <branch> [repository]
##
@werkshy
werkshy / statsd_admin_client.py
Last active Aug 3, 2021
Python class for interacting with the statsd admin interface. List stats, counters, timers, and gauges. Delete counters, timers, and gauges.
View statsd_admin_client.py
import socket
import simplejson as json
# Copyright (c) EnergyHub, Inc 2013
# Released under MIT license.
class StatsdAdminClient(object):
"""
A client for statsd admin interface.
Example commands: stats, counters, timers, gauges, delcounters, deltimers, delgauges, quit
@werkshy
werkshy / Makefile
Last active Aug 29, 2015
Makefile for ruby-protoc (generate .pb.rb files from .proto files).
View Makefile
# Brief makefile to create ruby objects from protocol buffer definitions
GENDIR=./lib/rails-pipeline/protobuf
RUBY_PROTOC=bundle exec ruby-protoc
PROTOS=$(wildcard $(GENDIR)/*.proto)
PBS=$(PROTOS:%.proto=%.pb.rb)
all: $(PBS)
%.pb.rb: %.proto
@werkshy
werkshy / init.rb
Last active Jan 11, 2017
Heroku plugin that installs busybox onto a dynos before dropping you into a bash shell.
View init.rb
#!/usr/bin/env ruby
# Put this file at ~/.heroku/plugins/busybox/init.rb
# Call it with 'heroku busybox'
require 'heroku/helpers'
require 'heroku/command'
require 'heroku/command/run'
class Heroku::Command::Busybox < Heroku::Command::Run
@werkshy
werkshy / config__initializers__active_merchant.rb
Created Apr 2, 2014
Mock Authorize.net CIM Gateway (ActiveMerchant). Released under the MIT License
View config__initializers__active_merchant.rb
# Initializer where we inject the mock gateway into global variable AUTHNET_GATEWAY or setup the real client
if !Rails.env.production?
ActiveMerchant::Billing::Base.mode = :test
end
$using_mock_auth_net_gateway = false
# Use FORCE_AUTH_NET to use the real Auth.net API in tests
# Use MOCK_AUTH_NET to use the mock Auth.net API even in development (good on a plane!)
View keybase.md

Keybase proof

I hereby claim:

  • I am werkshy on github.
  • I am werkshy (https://keybase.io/werkshy) on keybase.
  • I have a public key whose fingerprint is 6A5D 2103 A497 E1FD 7584 A901 C04E 8DF7 B887 797C

To claim this, I am signing this object: