Skip to content

Instantly share code, notes, and snippets.

View martensonbj's full-sized avatar

Brenna Martenson martensonbj

  • Seattle/Remote
  • 14:32 (UTC -08:00)
View GitHub Profile
@martensonbj
martensonbj / cfu_crud_in_sinatra.markdown
Last active December 3, 2015 03:40 — forked from rwarbelow/cfu_crud_in_sinatra.markdown
CRUD in Sinatra -- Check for Understanding
  1. Define CRUD.

CRUD stands for Create, Read, Update, and Delete which are associated with the verbs POST, GET, UPDATE, and DELETE in HTTP.

  1. There are seven verb + path combinations that are necessary in a basic Sinatra app in order to provide full CRUD functionality. List each of the seven combinations, and explain what each is for.

  2. READ '/tasks' - GET a view of all tasks from index.erb

  3. READ '/tasks/:id' - GET a view of a specific task from show.erb

  4. CREATE(pt1) 'tasks/new' - GET a form to create a new task in new.erb

  5. CREATE '/tasks' - POST data to the server and redirect to '/tasks'

@martensonbj
martensonbj / sandi-metz-review.md
Last active March 18, 2016 17:20
Review of Sandi Metz's 4 Rules For Developers

###Sandi Metz's Rules For Developers

Sandi Metz states four rules to maintain good code:

  1. Classes can be no longer than one hundred lines of code.
  2. Methods can be no longer than five lines of code.
  3. Pass no more than four parameters into a method. Hash options are parameters.
  4. Controllers can instantiate only one object. Therefore, views can only know about one instance variable and views should only send messages to that object.

In my opinion, rule 2 is the most difficult to follow as a new developer. It is difficult to determine when a long method should be broken into smaller methods, especially if its because of a single if else statement. As I learn more about what good code is, my methods are getting progressively shorter. That being said, access to the breadth of knowledge necessary to know how to efficiently navigate around a problem is still a work in progress. It will be an interesting challenge to keep this

@martensonbj
martensonbj / array-prototype-methods.markdown
Last active March 23, 2016 18:06 — forked from stevekinney/array-prototype-methods.markdown
Checks for Understanding - JS Array Prototypes

Array Prototype Methods

I understand that functions in JavaScript can take any number of arguments.

  • I also understand that you can ask for the arguments to be printed to the console if you're confused with what is being considered an argument. console.log(arguments)- JS MAGIC!

I can describe the similarity between blocks in Ruby and anonymous functions in JavaScript.

  • Ruby functions take blocks like so: array.each do {|thing| thing.to_s } which then iterates over said thing and makes it a string.
  • JS functions take anonymous functions that implicitly call an object, using the "any number of arguments but one of those arguments will be an individual element" idea: ```array.forEach(function(thing){ thing.toUpperCase });

Where are the methods available to all arrays (e.g. forEach, map, etc.) defined?

@martensonbj
martensonbj / package-management.markdown
Last active March 24, 2016 18:43 — forked from rrgayhart/package-management.markdown
The Dangers of Using Code You Don't Control

JavaScript Functions

I can explain the difference between function declarations and function expressions.

  • A function declaration is a named function that is not stored as a variable. An expression is an anonymous function set to a variable.
function logSomething(thing){
  console.log('something');
}```

@martensonbj
martensonbj / clearfix-lightning-talk.md
Last active March 31, 2016 02:10 — forked from ToniRib/lightning_talk_toni_rib_outline.md
Make Divs Follow the Rules

HOW DO I MAKE THIS DIV LISTEN TO ME

Background

  • One of the more frustrating aspect of styling a web page is putting HTML elements in the center of the page and making divs line up the way you want. There are multiple ways to do this and in my talk I want to go over why you'd use one vs another.

Concept 1: float & clearfix

  • Using Float to move elements to the left or right
  • Why it's important to use clear: both after using float
@martensonbj
martensonbj / require.markdown
Last active April 4, 2016 02:44 — forked from rrgayhart/require.markdown
The Concept of Require

When you start working with WebPack for GameTime, you'll notice that you can't just define a variable in one file and find it in another as easily as you can in Rails.

Read Node.js, Require and Exports and Organize Your Code with RequireJS

Fork this gist and answer the following questions:

  • In the context of Node, what is a module?
  • A module is a containing element for related pieces of code. Often a separate .js file, modules are used to organize and pass along information to other files using the require() syntax.
@martensonbj
martensonbj / pr-template.md
Created April 10, 2016 19:50 — forked from rrgayhart/pr-template.md
Modified Quick Left PR Template

What's this PR do?

Where should the reviewer start?

How should this be manually tested?

Any background context you want to provide?

Screenshots (if appropriate)

What gif best describes this PR or how it makes you feel?

Introduction to Sass/SCSS

Goals For This Lesson:

  1. Get a general understanding of Sass and SCSS
  2. Understand: - Variables - Nesting - Color Functions - Math Functions

How to Setup Sass

Sass will watch for any files with a .scss or .sass extension and compile them into .css files for you.

You should continue reading if...

  • You have a basic html/css/js structure
  • You have NOT integrated node, webpack, or other fancy package managers (they have their own set uÂp rules)

Verify that you have Ruby

The most common way to install Sass is by using Ruby.