Skip to content

Instantly share code, notes, and snippets.

View bsharpe's full-sized avatar

Ben Sharpe bsharpe

View GitHub Profile

Keybase proof

I hereby claim:

  • I am bsharpe on github.
  • I am bwsharpe5 (https://keybase.io/bwsharpe5) on keybase.
  • I have a public key ASB-hukRAnfzydS2gLUiUe4ulpjn3S5NXWPcwQGtqS8qZQo

To claim this, I am signing this object:

@bsharpe
bsharpe / perf_test.rb
Created November 7, 2021 18:21
Simple ruby micro benchmark tool with performance and memory reports
# frozen_string_literal: true
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
gem "benchmark-ips"
gem "benchmark-memory"
end
@bsharpe
bsharpe / iterm_open_with
Last active May 21, 2021 13:32 — forked from paresharma/iterm_open_with
Semantic history command for iTerm2 and Visual Studio Code Insiders editor. In iTerm's Preferences > Profiles > Default > Advanced > Semantic History, choose "Run command..." and enter "/your/path/to/iterm_open_with \1 \2".
#!/bin/sh
file "$1" | grep -q "text"
if [ $? -ne 0 ]; then
/usr/bin/open $1
else
if [[ -z "$2" ]]; then
FILE_PATH="$1"
else
FILE_PATH="$1:$2"
fi
@bsharpe
bsharpe / notes.md
Last active October 17, 2023 22:00
Installing PostGIS 2.5.5 onto Postgresql@11 -- Mac OS X
  • brew install postgresql@11
  • go to https://postgis.net/ and download 2.5.x
  • extract
  • cd into folder
  • brew install proj pcre json-c
  • use brew info proj / pcre / json-c to find the following directories
./configure --with-projdir=/usr/local/Cellar/proj/7.0.0 --with-jsondir=/usr/local/Cellar/json-c/0.13.1 --with-pcredir=/usr/local/Cellar/pcre/8.44
make
make install
@bsharpe
bsharpe / ruby.json
Created December 28, 2019 13:08
Rails Snippets
{
"Comments Features": {
"prefix": "]fe",
"body": [
"\t## FEATURES"
]
},
"Comments Attributes": {
"prefix": "]at",
"body": [
# Why do this?
context "some test" do
before { setup_work }
it do
expect(things).to be_correct
end
end
# when you can do this?
@bsharpe
bsharpe / basic_member_support.rb
Created June 22, 2017 19:39
The most useful module for Rails controllers
module BasicMemberSupport
extend ActiveSupport::Concern
protected
def find_member(id)
@member = collection.find(id)
end
def build_member(attrs = nil)