Skip to content

Instantly share code, notes, and snippets.

View iandouglas's full-sized avatar

w. ian douglas iandouglas

View GitHub Profile
@iandouglas
iandouglas / gist:53261aa9effc17461eac4bc1b08bc9b7
Created June 26, 2017 17:37 — forked from giannisp/gist:b53a76047b07751ed3ade3c1db1d2c51
Upgrade PostgreSQL 9.5.5 to 9.6.1 using Homebrew (macOS)
After automatically updating Postgres to 9.6.1 via Homebrew, the pg_ctl start command didn't work.
The error was something like "database files are incompatible with server".
Database files have to be updated before starting the server, here are the steps that had to be followed:
# need to have both 9.6.1 and latest 9.5.x installed, and keep 9.6.1 as default
brew unlink postgresql
brew install postgresql95
brew unlink postgresql95
brew link postgresql
@iandouglas
iandouglas / gist:f2329fe7f4e5372a9a2346853a50c22b
Created June 26, 2017 17:37 — forked from giannisp/gist:b53a76047b07751ed3ade3c1db1d2c51
Upgrade PostgreSQL 9.5.5 to 9.6.1 using Homebrew (macOS)
After automatically updating Postgres to 9.6.1 via Homebrew, the pg_ctl start command didn't work.
The error was something like "database files are incompatible with server".
Database files have to be updated before starting the server, here are the steps that had to be followed:
# need to have both 9.6.1 and latest 9.5.x installed, and keep 9.6.1 as default
brew unlink postgresql
brew install postgresql95
brew unlink postgresql95
brew link postgresql
@iandouglas
iandouglas / aggregated_feed.json
Created June 28, 2017 16:41
Stream Feed Output
{
"next": "",
"duration": "46ms",
"results": [{
"created_at": "2017-06-28T16:38:58.806970",
"updated_at": "2017-06-28T16:38:58.806970",
"activities": [{
"actor": "ian",
"foreign_id": "5",
"target": null,
@iandouglas
iandouglas / game_of_life.md
Last active March 1, 2018 16:20
Turing Code Retreat - Game of Life

Code Retreat Rules of Engagement

Agenda:

  • 9:00am, kick-off in Clarke Hall and Iteration 1
    • 10:20am, break time
  • 10:30am, meet back in Clarke Hall for Iteration 2
    • 11:50am, break for lunch
  • 1:00pm, meet back in Clarke Hall for Iteration 3
  • 2:20pm, break time

Why isn't using POST for everything considered RESTful?

Context/Rephrasing: Why can't we use POST as the HTTP verb for every request/response in the HTTP request/response cycle?

In the mid-90's, when the web was new, everything was a GET or a POST. Through developing the HyperText Transport Protocol (HTTP) it was determined that this wasn't flexible enough, and opened many other HTTP methods (aka "verbs") such as PUT, PATCH and DELETE.

Even today, when the "web" is more than 20 years old, <form> tags will still only send data using GET or POST, but modern frameworks have a bit of a way around that, and there are other ways using JavaScript to send data using other methods/verbs.

When we consider how "endpoints" (URIs) are built in our applications, it's far easier to say "if I'm trying to GET this URI" or "I'm trying to DELETE something based on this URI" by having several different endpoints with short blocks of code, like this:

@iandouglas
iandouglas / scraper.rb
Created August 10, 2018 19:06
Scraping GitHub pull requests using Ruby
# determine if a user has made a pull request (or several), returning a JSON payload either way
require 'nokogiri'
require 'open-uri'
require 'json'
student = '' # 'iandouglas'
repo = 'turingschool/portfolios'
doc = Nokogiri::HTML(open("https://github.com/#{repo}/pulls"))
@iandouglas
iandouglas / README.md
Created September 7, 2018 14:33
mcOS X High Sierra, Rails and PostgreSQL installation notes

The "High Sierra" build of macOS X removed a legacy folder path where some library files are generally installed for tools that need to be compiled. If you click on the 'apple' icon in the top left corner of your screen, if the text in large font says something like "macOS High Sierra" then this set of instructions could help fix some problems for you.

If you have installed PostgreSQL before upgrading to High Sierra, this may not affect you and these installation notes may not help.

If your Macbook came with High Sierra, or you've upgraded to High Sierra before installing PostgreSQL, this may affect you and you can keep reading.

Assumptions:

  • you're using Homebrew
@iandouglas
iandouglas / README.md
Last active August 26, 2024 17:38
Intro to Co-Authored Git Commits

Intro to Co-Authored Git Commits

Why

In student projects, I commonly look at contribution graphs to see how much code they worked on, to get an idea if one student is doing more work than others on the project. This can be used for coaching and performance grading.

How

Start with your ~/.gitconfig file in your home folder. Add these lines:

@iandouglas
iandouglas / README.md
Created February 11, 2019 04:27
Turing Mod 2 Backend, Rails 5.1 FactoryBot examples

Terminology:

  • ... means "whatever else is already here", don't actually input three dots!

To get started, add the following gem in your Gemfile in the :development, :test group, and run 'bundle update'

group :development, :test do
@iandouglas
iandouglas / cr10mini_prusaslicer_configbundle.ini
Created April 18, 2020 07:44
PrusaSlicer CR10 Mini Config Bundle
# generated by PrusaSlicer 2.2.0+ on 2020-04-18 at 07:37:36 UTC
[print:Creality CR10 Mini]
avoid_crossing_perimeters = 0
bottom_fill_pattern = rectilinear
bottom_solid_layers = 3
bottom_solid_min_thickness = 0
bridge_acceleration = 0
bridge_angle = 0