Skip to content

Instantly share code, notes, and snippets.

garrettmac garrettmac

Block or report user

Report or block garrettmac

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@garrettmac
garrettmac / index.html
Last active Mar 28, 2019
React at CodePen
View index.html
<div id="contentAreaDiv"></app>
@garrettmac
garrettmac / index.html
Created Mar 28, 2019
React at CodePen
View index.html
<div id="app"></app>
@garrettmac
garrettmac / index.html
Last active Mar 28, 2019
React at CodePen
View index.html
<div id="app"></app>
@garrettmac
garrettmac / README.md
Last active Jun 11, 2018
CS - Questions.
View README.md

Leave comments formmated like so:

<details>
<summary>My Question Here</summary>

<hr>
And I will answer here
<hr>
@garrettmac
garrettmac / Object-Oriented-Programming.md
Created Sep 15, 2017
MEDIUM BLOG POST - Javascript’s 3 Major Paradigms: The Three tenets of Object Oriented Programming [part 2 of 4]
View Object-Oriented-Programming.md

Javascript Paradigms

1. Object Oriented Programming (OOP) Paradigms

What is OOP?

What?

Object Oriented Programming (OOP) refers to using self-contained pieces of code to develop applications. We call these self-contained pieces of code objects, better known as Classes in most OOP programming languages and Functions in JavaScript.


Objects can be thought of as the main actors in an application, or simply the main “things” or building blocks that do all the work. As you know by now, objects are everywhere in JavaScript since every component in JavaScript is an Object, including Functions, Strings, and Numbers.

Why?

@garrettmac
garrettmac / 4-Currying-how.js
Last active Sep 15, 2017
MEDIUM BLOG POST - Javascript’s 3 Major Paradigms: The Five tenets of Functional Programming [part 3 of 4]
View 4-Currying-how.js
function add(a, b) { 
return a + b; 
}
add(3, 4);//returns 7
//This is a function that takes two arguments, a and b, and returns their sum. We will now curry this function:
function add(a) { 
return function (b) { 
return a + b; 
@garrettmac
garrettmac / 3-recursion-how.js
Created Sep 15, 2017
MEDIUM BLOG POST - Javascript’s 3 Major Paradigms: The Five tenets of Functional Programming [part 3 of 4] Copy Raw
View 3-recursion-how.js
function iterativeFactorial(n) {
 let product = 1;
 for (let i = 1; i <= n; i++) {
 product *= i;
 }
 return product;
}
@garrettmac
garrettmac / 2-functionsal-composition-how.js
Created Sep 15, 2017
MEDIUM BLOG POST - Javascript’s 3 Major Paradigms: The Five tenets of Functional Programming [part 3 of 4]
View 2-functionsal-composition-how.js
const vehicles = [
 { make: ‘Honda’, model:CR-V’, type: ‘suv’, price: 24045 },
 { make: ‘Honda’, model: ‘Accord’, type: ‘sedan’, price: 22455 },
 { make: ‘Mazda’, model: ‘Mazda 6’, type: ‘sedan’, price: 24195 },
 { make: ‘Mazda’, model:CX-9’, type: ‘suv’, price: 31520 },
 { make: ‘Toyota’, model:4Runner’, type: ‘suv’, price: 34210 },
 { make: ‘Toyota’, model: ‘Sequoia’, type: ‘suv’, price: 45560 },
 { make: ‘Toyota’, model: ‘Tacoma’, type: ‘truck’, price: 24320 },
 { make: ‘Ford’, model:F-150’, type: ‘truck’, price: 27110 },
@garrettmac
garrettmac / 1-Higher-order-functions-how.js
Last active Sep 15, 2017
MEDIUM BLOG POST - Javascript’s 3 Major Paradigms: The Five tenets of Functional Programming [part 3 of 4]
View 1-Higher-order-functions-how.js
const vehicles = [
 { make: ‘Honda’, model:CR-V’, type: ‘suv’, price: 24045 },
 { make: ‘Honda’, model: ‘Accord’, type: ‘sedan’, price: 22455 },
 { make: ‘Mazda’, model: ‘Mazda 6’, type: ‘sedan’, price: 24195 },
 { make: ‘Mazda’, model:CX-9’, type: ‘suv’, price: 31520 },
 { make: ‘Toyota’, model:4Runner’, type: ‘suv’, price: 34210 },
 { make: ‘Toyota’, model: ‘Sequoia’, type: ‘suv’, price: 45560 },
 { make: ‘Toyota’, model: ‘Tacoma’, type: ‘truck’, price: 24320 },
 { make: ‘Ford’, model:F-150’, type: ‘truck’, price: 27110 },
You can’t perform that action at this time.