Skip to content

Instantly share code, notes, and snippets.

Avatar

Kevin R. Barnes vinbarnes

  • Nashville, TN
View GitHub Profile
View inherit_test_setup.rb
class Test
def run
puts ">>> starting test run: #{self.class.name}"
setup
the_test_methods.each do |test_method|
puts "running #{self.class.name}##{test_method}"
send(test_method)
end
end
View Instatest.md

Test Title

heading

PARAGRAPH starts here.

Then continues on for a bit.

@vinbarnes
vinbarnes / repl.js
Created Apr 4, 2019 — forked from blackwright/repl.js
Sequelize REPL
View repl.js
// Require the REPL module
// and models
let repl = require('repl').start({});
const models = require('./models');
// Make the `models` object
// a global variable in the
// REPL
repl.context.models = models;
View optparse-template.rb
#!/usr/bin/env ruby
#/ Usage: <progname> [options]...
#/ How does this script make my life easier?
# ** Tip: use #/ lines to define the --help usage message.
$stderr.sync = true
require 'optparse'
# default options
flag = false
option = "default value"
@vinbarnes
vinbarnes / gist:57de4ab6c60d32d8b72411e883e65f23
Last active Apr 18, 2017
stash listing with relative age
View gist:57de4ab6c60d32d8b72411e883e65f23
$ git stash list --format="%gd (%cr): %s"
stash@{0} (7 weeks ago): On neuter-mssql-in-prod: neuter in production
stash@{1} (6 months ago): On fix-group-messages-being-archived: archived-spec
stash@{2} (1 year, 1 month ago): On staff-comments: staff persona test
stash@{3} (1 year, 3 months ago): On staffng-integration-tests: 77e5f6c added more to staff flow
stash@{4} (1 year, 3 months ago): On staffng-integration-tests: WIP staff onboarding integration test
stash@{5} (1 year, 5 months ago): On staff-ng-add-switch-link: 4823a45 Jk don't hardcode
stash@{6} (1 year, 6 months ago): On staff-ng-groups: staffng-routing
stash@{7} (1 year, 7 months ago): On master: readable policy spec
View raise.rb
module NewUserActivation
class UnknownStrategyError < ArgumentError
def initialize
raise self
end
end
end
View mem_collector.sh
#!/bin/bash
# to run:
# $ nohup mem_collector.sh &
while :
do
pids=( $(ps auxwww |egrep 'ruby|bundle' | awk '{print $2}') )
echo $(date) >> ruby_usage.log
ps -o pid,pcpu,pmem,rss,args ${pids[@]/#/-p } >> ruby_usage.log
View list_indices.json
Get the list of ES indices
GET <host>:<port>/*/_aliases?pretty
{
"development-section-16": {
"aliases": {}
},
"development-section-15": {
"aliases": {}
View capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
View spec_helper.rb
module CharacterizationTestHelpers
def currently(description, *options, &block)
it("*CURRENTLY* #{description}", *options, &block)
end
end
You can’t perform that action at this time.