Skip to content

Instantly share code, notes, and snippets.

Avatar

Josh Minnich joshmosh

View GitHub Profile
@joshmosh
joshmosh / One Dark Slack
Created Dec 16, 2019
One Dark Theme for Slack
View One Dark Slack
#21252B,#31363F,#61AFEF,#FFFFFF,#31363F,#ABB2BF,#98C379,#E06C75
View one-dark-colors.scss
.fg {
color: #abb2bf;
}
.bg {
color: #2a2c34;
}
.highlight {
color: #5c6370;
View rails_status_code_symbols.md

1xx Informational

Status Code Status Message Symbol
100 Continue :continue
101 Switching Protocols :switching_protocols
102 Processing :processing

2xx Success

@joshmosh
joshmosh / upload.rb
Created Apr 19, 2018
How to upload a directory of files in parallel to S3 using Ruby and Parallel
View upload.rb
require "parallel"
require "aws-sdk-s3"
# Read more about the aws sdk config here: https://github.com/aws/aws-sdk-ruby#configuration
Aws.config.update(
region: "replace_with_region_id",
credentials: Aws::Credentials.new(
"reaplce_with_aws_access_key_id",
"reaplce_with_aws_secret_access_key"
)
@joshmosh
joshmosh / application_helper.rb
Created Mar 26, 2018
Rails Active Link Helper
View application_helper.rb
module ApplicationHelper
def app_link_to(name, url, html_options, active_options)
css_class = html_options[:class].split(' ')
if params[:controller] == active_options[:controller]
css_class << active_options[:active_class]
end
html_options[:class] = css_class.join(' ')
@joshmosh
joshmosh / description.md
Created Sep 1, 2017
Proud database moments 👏 🎉
View description.md

This is much faster on my local machine but the report below shows how well my database optimizations are working on AWS hardware.

Database Instance Class: db.t2.micro Database Engine: Postgres 9.6.2

The test is not a table with a single colum. There are 3 integer columns and 10 string columns. I can't give away too much for information for security purposes.

View address_example.csv
first_name last_name address
Josh Minnich 1100 S Lamar Blvd, Austin, TX 78704
@joshmosh
joshmosh / 01.md
Last active Apr 30, 2020
Using binary UUIDs with Ruby (on Rails) and MySQL
View 01.md

Binary UUIDs are much more efficient in space and lookups compared to VARCHAR or CHAR UUIDs. To better exmplain how they work I have a few examples of raw sql and how that translates in a programming language like Ruby using the UUID tools module. All examples will reference the following database table and schema.

Table name: users

 id          :uuid(16)
 first_name  :string(255)
 last_name   :string(255)
View keybase.md

Keybase proof

I hereby claim:

  • I am joshmosh on github.
  • I am joshmosh (https://keybase.io/joshmosh) on keybase.
  • I have a public key whose fingerprint is 2D9D 509E EB5F 74FC 11A2 E124 1BBD 0FB0 9912 4CB5

To claim this, I am signing this object: