Skip to content

Instantly share code, notes, and snippets.

View kjohnston's full-sized avatar

Kenny Johnston kjohnston

  • Laguna Niguel, CA
View GitHub Profile
@robhrt7
robhrt7 / MySQL_5-7_macOS.md
Last active February 28, 2024 03:48 — forked from nrollr/MySQL_macOS_Sierra.md
Install MySQL 5.7 on macOS using Homebrew

This is a fork of original gist https://gist.github.com/nrollr/3f57fc15ded7dddddcc4e82fe137b58e, with slight changes on pointing to 5.7 version branch, instead of 8 (latest default of MySQL in Hombrew).

Install MySQL 5.7 on macOS

This procedure explains how to install MySQL using Homebrew on macOS (Sierra 10.12 and up)

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • Note: Homebrew will download and install Command Line Tools for Xcode 8.0 as part of the installation process.
#minitest/spec
# Drop SOLO in the name of the test you want to run and then run
# solo and tab complete the path/to/the/test/file.rb
solo() {
ruby -Itest $1 --name /SOLO/
}
# describe SomeClass do
# it "does some stuff SOLO" do
guard "minitest", all_on_start: false, start_on_start: false do
# with Minitest::Spec
watch(%r|^test/(.*)_test\.rb$|)
watch(%r|^app/(.*)/(.*)\.rb$|) { |m| "test/#{m[1]}/#{m[2]}_test.rb" }
watch(%r|^lib/(.*)([^/]+)\.rb$|) { |m| "test/#{m[1]}#{m[2]}_test.rb" }
watch(%r|^test/test_helper\.rb$|) { "test" }
watch(%r|^test/support/|) { "test" }
end
@bousquet
bousquet / gist:38449825ee21d3fea098
Last active April 30, 2017 21:17
REST API Design Doc

REST API Design Doc

Base URL

Each version of the API should remain functional for a period of time after the next version is released to allow client applications time to migrate to the next version. Typically this is done by placing a version number in a query parameter ?version=20151201. If no version is provided, the latest API version will be assumed.

https://company.com/api/

Authentication

@kostia
kostia / upgrade-rails41-to-42-with-rspec2.md
Last active August 29, 2015 14:13
Upgrading Rails 4.1 to 4.2 with RSpec 2

Upgrading Rails 4.1 to 4.2 with RSpec 2

Upgrading Rails is normally a simple task, especially if the difference between the versions is not very large. But in the case of 4.1 to 4.2 upgrade of an application (or a library) using RSpec 2, it can get messy, because RSpec 2 is not fully compatible with Rails 4.2. So in order to upgrade Rails, you have to upgrade RSpec first. Here how we did that:

In order to upgrade to RSpec 3 we first upgrade to RSpec 2.99.0, run the specs to see the deprecations, fix the deprecations and then upgrade to 3.1.0.

  1. First remove all RSpec gems except rspec-rails (all the rspec-* gems).
  2. Then update rspec-rails gem to version 2.99.0.
@mfpiccolo
mfpiccolo / serializer_monkey.rb
Last active August 29, 2015 14:13
A active record monkey patch to make serialization easy with active model serializers
# Monkey patch for ActiveRecord::Base to return serialized JSON in the format
# of an ActiveModel::Serializer.
module SerializedJson
extend ActiveSupport::Concern
def to_serial(serializer=nil, opts={})
if self.respond_to?(:map)
serializer ||= (self.base_class.name + "Serializer").constantize
serialized_collection = self.map do |resource|
@tobek
tobek / get-image-urls.js
Last active May 2, 2024 23:39
Save images from chrome inspector/dev tools network tab
/* open up chrome dev tools (Menu > More tools > Developer tools)
* go to network tab, refresh the page, wait for images to load (on some sites you may have to scroll down to the images for them to start loading)
* right click/ctrl click on any entry in the network log, select Copy > Copy All as HAR
* open up JS console and enter: var har = [paste]
* (pasting could take a while if there's a lot of requests)
* paste the following JS code into the console
* copy the output, paste into a text file
* open up a terminal in same directory as text file, then: wget -i [that file]
*/
@snormore
snormore / travisci-flowdock.md
Last active January 1, 2016 01:29
TravisCI Flowdock notificaitons for public repo and private flowdock rooms

TravisCI Flowdock notifications for public repo and private flowdock rooms

notifications:
@elskwid
elskwid / service.rb
Created December 3, 2013 19:46
Service Object WIP
# An attempt to codify how we're using Service Objects now
#
# Most follow this pattern:
#
# class SomeService
#
# def self.call(a, b, &block)
# new(a, b).call(&block)
# end
#