Skip to content

Instantly share code, notes, and snippets.

REST? Hypermedia? Do I know what I'm talking about?
I like to think I'm a smart man. I work hard to understand the technologies I use. Embarisingly I haven't ever really looked into REST.
The embarasment isn't that there's a technology I don't know about, there are a lot of technologies I don't know about! There are so many technologies I'll never be able to deep dive into them all. It's embarasing because I don't know a foundational premise for the work I do. I end up working with a lot of APIs, so I'm makeing calls to and fro, making POST requests with JSON and parsing GET responses. I feel like I know what I'm doing when I have all the right verbs in my controller. I can be helpful when I see this:
```
class UsersController < ApplicationController
def create
@pdougall1
pdougall1 / environment.js
Last active August 29, 2015 14:12
how ember cli creates environment variables
// used thusly `ENV.AppName.varName`
module.exports = function(environment) {
var ENV = {
modulePrefix: 'test-ember',
environment: environment,
baseURL: '/',
locationType: 'auto',
EmberENV: {
FEATURES: {
@pdougall1
pdougall1 / gist:5f34d689d96d8066d733
Last active August 29, 2015 14:21
setting up local environment

Setting up my local environment

basics

instll homebrew

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

use iTerm

I think we need to just go download it

Things We need to do

  • Sign in to DealShield http://dealshield.net/users/sign_in
  • Setup ssh config with human readable names
  • Dig into and document how to look into the logging
  • Document problems with VCR testing. If a VCR test fails the rest of the VCR tests will also fail because a failing VCR test will not allow the recording to be ejected, and therefor will not allow another to be added.
@pdougall1
pdougall1 / gist:451e723c59c44e45e02a
Last active November 3, 2015 20:16
POODR class notes

Notes and observations

  • The next one to prove the first is wrong
  • Choose a name inline with the concept in the domain.
    • Good OO code names concepts, not worried about implementation
  • Terseness is cleverness (not goodness), stop picking on each other for being simple.
  • Smallest change you can make to prove the last test insuficient.
  • Solve the easy problems first, then maybe the hard ones become easy.
  • DRY is good, but sometimes duplication makes sense, if it passes the inebriation test, check it in and walk away
  • Open/Close Add new features without adding new code
  • lean on the green
@pdougall1
pdougall1 / gist:e79fee71e3997fe13f09
Last active November 3, 2015 20:16
POODR class notes (day 2)

Code smells, get really good at code smell (brown bag)

All you have to know is the codes smells

make a million new things > mutate objects

Forwardable (delegation)

Don't go on a virtical tangent, instead tiptoe away and finish the horizontal refactor

@pdougall1
pdougall1 / gist:a8b1206758aab172509c
Created November 9, 2015 00:24
refactoring flow
╔═════════════════╗ ┌─────┐ ╔═══════════════════╗
║ ║ │ YES │ ║ Make the intended ║
───────▶║ Is it open? ╠──┴─────┴──────▶║ change. ║
▲ ║ ║ ▲ ║ ║
│ ╚═════════╦═══════╝ │ ╚═══════════════════╝
│ │ │
│ ┌────┤ │
│ │ NO │ │
│ └────┤ │
│ │ │
class Hash
def deep_clone
Marshal.load(Marshal.dump(self))
end
def compact
self.select { |_, value| !value.nil? }
end
require 'delegate'
module Queries
class SomeQuery < SimpleDelegator
def initialize
super query_hash
end
private

STARTING A NEW THING

git checkout -b <name-of-branch>

do some work git commit -am "<some message about the new commit>"

do some more work git commit -am "<some message about the new commit>"

git push origin # can tab complete the name of branch