Skip to content

Instantly share code, notes, and snippets.

View mrinterweb's full-sized avatar

Sean McCleary mrinterweb

View GitHub Profile
@mrinterweb
mrinterweb / gift_name_draw.rb
Created November 26, 2021 23:03
Script for gift name draw
require 'pp'
NAMES = %w[Frank Sean Bryn Quinn Beckett Katie Brent Brook Katelynn Adrian].freeze
pickers = NAMES.clone
available = NAMES.clone.shuffle
matches = {}
pickers.each do |picker|
picked = available.shift
@mrinterweb
mrinterweb / sb.rb
Created February 23, 2021 22:21
Easy fuzzy branch switching
#! /usr/bin/env ruby
# Switch to git branch by matching part of a name
results = `git branch -l | grep -i #{ARGV[0]} | cut -f 1`
branchNames = results.split("\n").map { |bn| bn.sub(/^\*/, '').strip }
if branchNames.length == 1
`git checkout #{branchNames.first}`
else
puts 'More than one branch name matched'
@mrinterweb
mrinterweb / vultr-create-docker-server.sh
Created January 31, 2020 08:53
Creating, connecting to, and destroying a server on Vultr
#!/bin/bash
set -e
# creates in Seattle using 2 core, 2GB RAM, 64GB storage on Ubuntu 19.04
# note I was using a custom script to install docker. Basically "snap install docker"
vultr-cli server create --region 4 --plan 401 --os 338 --script-id <redacted> --label="docker-dev"
echo ""
echo "Wait about a minute to auto-connect..."
#!/bin/sh
set -e
set -u
set -o pipefail
service_name="${1:-monolith}"
container_id="$(docker container ls | grep "opal_$service_name" | head -n1 | cut -d " " -f 1)"
docker logs -f $container_id
This file has been truncated, but you can view the full file.
Date/Time: 2020-01-21 22:46:49 -0800
End time: 2020-01-21 22:47:10 -0800
OS Version: Mac OS X 10.15.2 (Build 19C57)
Architecture: x86_64h
Report Version: 29
Data Source: Stackshots
Shared Cache: 0x6b67000 1C9C4B5C-0A12-39CC-965C-B305BF7F36AA
Command: VimR
version: "2"
options:
verbose: true
syncs:
rails-app-sync:
compose-dev-file-path: 'docker-compose-dev.yml'
notify_terminal: false
src: './'
sync_strategy: 'native_osx'
sync_host_ip: '127.0.0.1'
# This is a ActiveRecord STI class
class Hyundai < Car
has_one :hyundai_details
delegate *HyundaiDetails::ACCESSIBLE_ACCESSOR_METHODS, to: :hyundai_details
default_scope { includes(:hyundai_details) }
def initialize(args = {})
hyundai_details_attrs = {}
args.each do |key, _val|
@mrinterweb
mrinterweb / gist:25eac01663309741240c45d18a0a3026
Created January 19, 2018 22:46
switch branches by name match
#! /usr/bin/env ruby
# Switch to git branch by matching part of a name
results = `git branch -l | grep -i #{ARGV[0]} | cut -f 1`
branchNames = results.split("\n").map { |bn| bn.sub(/^\*/, '').strip }
if branchNames.length == 1
`git checkout #{branchNames.first}`
else
puts 'More than one branch name matched'
@mrinterweb
mrinterweb / actions.js
Created October 2, 2017 19:55
A basic jsonapi serializer
import _ from 'lodash';
export default {
UPDATE_RATES({ commit }, results) {
if (results.data && results.data.length === 0) {
commit('UPDATE_RATES', []);
} else {
let mapAtributes = function(_val, key) {
return _.camelCase(key);
};
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});