Skip to content

Instantly share code, notes, and snippets.

@zdennis
zdennis / yaprc.rb
Created June 15, 2016 02:10
yaprc - loading dotenv
#
# I'll be the first to admit this isn't pretty, but I wanted to see what it would take to make
# dotenv and dotenv-rails aware.
#
# It works by reading in .env files after you CD into a directory and then it unapplies them when you leave
# the environment.
#
old_world_envs = []
Yap::Shell::Execution::Context.on(:before_execute) do |world, command:|
class Test
def self.validate_args(method_name, *args, &blk)
validated_method = "#{method_name}_with_validated_args"
original_method = "#{method_name}_without_validated_args"
define_method "#{method_name}_with_validated_args" do |*args, &blk|
# if args check out
send original_method, *args, &blk
# else
# fail "bad args!"
@zdennis
zdennis / grab
Created May 25, 2016 20:31
Splits output into columns and grabs a specified column
#!/usr/bin/env ruby
if STDIN.tty?
def print_help
puts <<-EOT.gsub(/^\s+\|/, '')
|Usage: ls | grab <column number>
| grab <column number> < INFILE
| grab <column number> <column number2> <column number3> ... < INFILE
|
|grab outputs a specific column of content from STDIN.
@zdennis
zdennis / testify-circleci-artfifact-xml
Created March 25, 2016 13:48
Takes a CircleCI artifact XML file and prints out an RSpec command to run the same set on the command-line
#!/usr/bin/env ruby
# Takes a CircleCI artifact XML file and prints out an RSpec command to
# run the same set on the command-line
file = ARGV.shift || STDIN.read
contents = IO.read(file)
random_seed = contents.scan(/Randomized with seed (\d+)/i).flatten.first
print "bundle exec rspec --order rand:#{random_seed} ",
contents.scan(/file="([^"]+)"/).uniq.join(" "),
@zdennis
zdennis / 1_simple-shell-blocking.rb
Last active July 15, 2016 14:54
Code efor Non-blocking REPL blog post.
#!/usr/bin/env ruby
prompt = "prompt> "
loop do
print prompt
input = gets.chomp
if input
exit if input == "exit"
system input
@zdennis
zdennis / results.md
Created November 23, 2015 15:56
strengths finder results from 2011

Learner

People who are especially talented in the Learner theme have a great desire to learn and want to continuously improve. In particular, the process of learning, rather than the outcome, excites them.

Intellection

People who are especially talented in the Intellection theme are characterized by their intellectual activity. They are introspective and appreciate intellectual discussions.

@zdennis
zdennis / att-experience.md
Last active November 22, 2015 23:18
AT&T price increase.

Here is what the issue is from my perspective.

Back in July we upgraded a phone to ATT Next. We were aware of new billing for that device, but it was not disclosed that it was going to change the access fee for the other three devices on the account at the time to $40/month (from $30/month).

At the time I had been traveling quite a bit for work and I had been going over on my data plan. Rather than spot the discrepancy right away I assumed the higher bills were me going over on my data.

Fast forward a couple of months (to September) and we add two additional devices to the plan. At the store we asked to do a plan that kept us at $300 (no more) due to budgetary reasons. We were told that was the case. So we had six devices and we upgraded to a 20Gb/month plan.

The first month the bill was higher than I anticipated so I contacted customer service via the online chat. The support rep shared with me that the first month was getting all of the one-time fees (minus the taxes that were paid at the AT&T store wh

# This will tell you which commits are on a topic branch that are on acceptance and release-candidate.
# It is to help you identify if there are commits on your topic branch that shouldn't be merged into
# acceptance or release-candidate.
#
# Example:
# check_branch my-topic-branch
#
function check_branch {
acceptance_branch=origin/acceptance
echo
@zdennis
zdennis / test.sql
Last active August 29, 2015 14:24
Innodb index performance: int vs. datetime
/*
* CREATE TABLE
*/
CREATE TABLE `test_indexes` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`val` int(11) DEFAULT NULL,
`created_at` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `created_at_idx` (`created_at`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
@zdennis
zdennis / Vagrantfile-snippet.rb
Created June 23, 2015 19:05
Installing NodeJS 0.12.x w/Chef
config.vm.provision "shell", inline: "
sudo apt-get install curl
curl -sL https://deb.nodesource.com/setup_0.12 | sudo bash -
sudo apt-get install nodejs
"