Skip to content

Instantly share code, notes, and snippets.

Working from home

Christopher Michael midwire

Working from home
Block or report user

Report or block midwire

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
midwire / git
Created Sep 10, 2018 — forked from scootcho/git
git commands #git #commands
View git

initialize git depository in the current directory

git init .

display the git remote/origin

cat .git/config
midwire /
Created Jun 7, 2018 — forked from cblackburn-ajla/
CentOS: rbenv install and system wide install
# CentOS rbenv system wide installation script
# Forked from
# Installs rbenv system wide on CentOS 5/6, also allows single user installs.
# Install pre-requirements
yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel \
make bzip2 autoconf automake libtool bison iconv-devel git-core
View Rails Standards and

Rails naming conventions

General Ruby conventions

  • Class names are CamelCase.
  • Methods and variables are snake_case.
  • Methods with a ? suffix will return a boolean, and are called predicates.
  • Methods with a ! suffix mean one of two things: either the method changes the state of the object instance in some fashion, or it will raise and exception instead of failing (such as Rails models' #save! vs. #save).
  • In documentation, ::method_name denotes a class method, while #method_name denotes a instance method.
midwire / git-merged-branches.rb
Created Oct 24, 2017 — forked from cblackburn-ajla/git-merged-branches.rb
Determine orphaned branches that have been merged into another branch.
View git-merged-branches.rb
#!/usr/bin/env ruby
# Get a list of merged branches
# You need to checkout the target remote branch before running. In other words,
# if your target branch is 'master', you have to have it checked out before you
# run this script, otherwise you will get an error like: `fatal: malformed
# object name master`. Git needs to have the branch checked out and pulled in
# order to find the branches that have/have-not been merged into it.
midwire / .pryrc
Last active May 13, 2019
[My .pryrc] It's awesome! #ruby
View .pryrc
require 'irb/completion'
require 'awesome_print'
Pry.config.print = proc { |output, value| output.puts }
rescue LoadError => err
puts "no awesome_print :("
Pry.commands.alias_command 'wh', 'whereami'
midwire / database_state_loader.rb
Created Jul 6, 2017 — forked from keithpitt/database_state_loader.rb
Note that this code only works with PostgreSQL, but it wouldn’t be too hard to adapt our approach for other relational databases.
View database_state_loader.rb
# Add to `spec/support/database_state_loader.rb`
class DatabaseStateLoader
class EnvironmentError < RuntimeError; end
def self.load(path)
def initialize(path)
midwire / gist:bd9aceb83cac086ac90862d30f968a37
Created Apr 12, 2017 — forked from trcarden/gist:3295935
Rails 3.2.7 SSL Localhost (no red warnings, no apache config)
View gist:bd9aceb83cac086ac90862d30f968a37
# SSL self signed localhost for rails start to finish, no red warnings.
# 1) Create your private key (any password will do, we remove it below)
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
midwire /
Created Mar 27, 2017 — forked from arobb/
Install macOS Sierra in VirtualBox on macOS host

Step 1 (Creating a bootable macOS Sierra ISO for VirtualBox):

  1. hdiutil attach /Applications/Install\ macOS\ Sierra\ Public\ -noverify -nobrowse -mountpoint /Volumes/install_app
  2. hdiutil create -o /tmp/Sierra.cdr -size 7316m -layout SPUD -fs HFS+J
  3. hdiutil attach /tmp/Sierra.cdr.dmg -noverify -nobrowse -mountpoint /Volumes/install_build
  4. asr restore -source /Volumes/install_app/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase
  5. rm /Volumes/OS\ X\ Base\ System/System/Installation/Packages
  6. cp -rp /Volumes/install_app/Packages /Volumes/OS\ X\ Base\ System/System/Installation/
  7. cp -rp /Volumes/install_app/BaseSystem.chunklist /Volumes/OS\ X\ Base\ System/BaseSystem.chunklist
midwire /
Last active Jun 11, 2017 — forked from pwnsdx/
Disable bunch of #$!@ in Sierra
# This is a draft but it works
# FIRST (I don't even know if it works but we'll assume yes)
# sudo launchctl list
# sudo launchctl disable system/netbiosd
# sudo launchctl disable system/parsecd
# sudo launchctl disable system/parentalcontrols.check
# sudo launchctl disable system/airportd
midwire /
Last active Sep 1, 2016 — forked from jjb/gist:7389552
Ruby 2.1 memory configuration

This all applies to Ruby 2.1. In some cases a setting is not available in 2.0, this is noted. There is also a different with 1.9, 1.8, and REE --- these are not noted.

All the relevant code is in


default: 10000

The number of heap slots to start out with. This should be set high enough so that your app has enough or almost enough memory after loading so that it doesn't have to allocate more memory on the first request (althogh this probably isn't such a big deal for most apps).

(todo: figure out how big a slot is. i think the answer can be infered from this code.)

You can’t perform that action at this time.