Skip to content

Instantly share code, notes, and snippets.

View AlexanderRD's full-sized avatar

Alexander Donkin AlexanderRD

  • Bless App
  • Berlin
View GitHub Profile
@AlexanderRD
AlexanderRD / gist:485f12395cc30f3444b7
Last active August 26, 2022 00:29
Delete all git branches with prefix
git branch -D `git branch | grep 'ard_*'`
@AlexanderRD
AlexanderRD / command_line
Created November 13, 2015 07:03
OS X to restart MySQL server
sudo /usr/local/mysql/support-files/mysql.server restart
rubocop -a `git diff --name-only --cached | grep '\.rb'`
def bin_to_hex(s)
s.unpack('H*').first
end
def hex_to_bin(s)
s.scan(/../).map { |x| x.hex }.pack('c*')
end
#Kudos to: http://anthonylewis.com/2011/02/09/to-hex-and-back-with-ruby/
@AlexanderRD
AlexanderRD / Exclude release|master branches
Created November 30, 2017 11:36
Local dev gihub branch clean-up
#Only delete branches merged into their upstream origins
git branch | grep -v "master" | grep -v "release" | xargs -n 1 git branch -d
# Delete branch regardless of merge status
git branch | grep -v "master" | grep -v "release" | xargs -n 1 git branch -D
@AlexanderRD
AlexanderRD / gist:2402e390908a268bc877d8903bbcce1c
Created June 28, 2018 12:07
Export Grape API docs to single html file using Swagger and Bootprint
# Ensure swagger docs have been generated for your app,
# by weirdly running your app locally and navigating to route
# that matches whwere the docs are mounted
rails s -p 3001
# Install bootprint
npm install -g bootprint
npm install -g bootprint-openapi
# Use Bootprint to generate docs from the default swagger docs location