Skip to content

Instantly share code, notes, and snippets.

View stevepentler's full-sized avatar

Steve Pentler stevepentler

View GitHub Profile

Computing In Technicolor

####Turing's Eyewear Problem

Background

  • Former optometrist, pony trainer, magician, and pedal cabber

Eyestrain:

  • 73% of adults under 30
@stevepentler
stevepentler / metz_rulez.md
Last active March 15, 2016 17:38
Sandi Metz' Rules For Developers

#####Classes can be no longer than one hundred lines of code. #####Methods can be no longer than five lines of code. #####Pass no more than four parameters into a method. Hash options are parameters. #####Controllers can instantiate only one object. Therefore, views can only know about one instance variable.

In my opinion, the 5 line limit is the most difficult to follow. I think the key to adhering to the rule is overly-descriptive method naming so anyone reviewing your code can easily distinguish what is happening within the method.

I've been using presenters lately, and I think it really helps move logic down the stack. Especially when you want to generate random offsets or have minimal amounts of logic, it's nice to be able to stick it in a PORO away from the controllers. In addition, the super method you get from SimpleDelegator is extremely helpful when passing a service just for its methods.

Class limitations can be the hardest to practice, but are the most easily solved with modules.

@stevepentler
stevepentler / speaking_javascript.md
Last active March 17, 2016 20:31
Speaking Javascript Chapters 3, 15, 16, 17

Which sections were interesting?

  • Why JS is okay with "failing silently"? But seriously, WHY?
  • Constructors. Are these the equivalent of a class in Ruby?
  • How common is it to create sad paths to throw an error within a function?
  • Dynamic relationships seem like they could get convoluted quickly and create some very dependent code.

Which sections did you totally skim?

  • I read everything except for CH17, see below...

Do you think the reading was valuable?

Respond in the comments of this issue with:

  1. What is something you learned that was particularly surprising/interesting?
  • Speceific selection ex: $('li').eq(1) to get the second list item without using an #id
  • I had no idea that you could chain events, ex: calling a click function AND a key-up function on the same selector
  • Expanding on that, you can pass in multiple events in a space seperated string, ex: $('li').on('click keydown', function()...
  1. What was something you already knew?
  • How to target selectors

Steve Pentler's exercisms

###Leap

######Response 1 The surprising aspect of this response is that there is no reference to else. She users an if statement and then closes her curly brackets, and then gets into the next condition without "else." I assume that JavaScript is smart enough to execute as if the statement is prefaced by "else."

######Response 2 No surprises here, very clean. I'm excited to hear why we need to add the final line "module.exports = Function"

#####Prep - example repo of CDN and file upload - gist for follow along #####Why this will save you an immense amount of time in future projects & make your future projects more valuable! (3 mins) #####Write 1 CSS skill you’d like to learn from this session on the board or +1 (3 mins) #####Materialize vs Bootstrap vs Semantic - (5 mins) - Cons - some bugs (ex: highlights wrong line in form, MIT license for students from Carnegie Mellon, not backed by Twitter like Bootstrap, much harder to find proper solutions on StackOverflow and other online sources - Pros - Unique from all other bootstrap sites, very approachable (good size of documentation), nice amount of jQuery animations, very clean tables #####Downloading into projects (15 mins)

  • upload files directly (a bit more difficult to setup)

###In broad strokes, summarize the event

  • Azer is an Indian Giver that decided to break the internet.
  • Kik is a thing that lots of people use, and they want their name back
  • Azer was like, yo, but this project is my heart and soul, and if I can't have it then nobody can!
  • The patent engineer was like, Azer, dude, calm down. Relax.
  • Azer was like "I AM F#CK|NG RELAXED, YOU FU$KING RELAX!!!!!!!!!!!!!!"
  • The patent engineer snitched to NPM like 5 times
  • Moral of the story, snitches don't get stiches, they get their name back
  • #betchesGonTryMe #azerOUT! #" I'llBiteYourFaceInTheNameOfOpenSourceLiberty"

(5) Intro

  • Why you should master styling, early
  • Pros/Cons of Materialize

(15) Good CSS vs Bad CSS with examples

(5) Uploading into Projects

(15) Documentation

alt image

  • Elements

    • can drag html element to new position
    • can delete or add entire html element
    • can add an id
    • click the pin to access hover/active/focus
    • click line number to access css file within chrome tools, make your changes and then right click => save as in the editing space
  • Console

- see test_helper ActionController::TestCase for JSON.parse refactoring
- Need to reload the idea on an update ex: ideas(:one).reload before assertions
- see the idea.rb for validating inclusions
- head :no_content in delete action on ideas_controller?
- include Rails.application.routes.url_helper in integration tests?
- Does declaring vars at the top of a file give them global scope? Or is it for readability?
- event.preventDefault(); ?
- see the hassles of asynchronous code and multiple threats (complicated testing)
- IdeaRepository.all - is this Lo-Dash?