Skip to content

Instantly share code, notes, and snippets.

View DominicTremblay's full-sized avatar

Dominic Tremblay DominicTremblay

View GitHub Profile
const movies = [
{ title: 'Black Panther', year: 2018, genre: 'action', rating: 7.4 },
{ title: 'Avengers Infinity War', year: 2018, genre: 'action', rating: 8.5 },
{
title: 'Spider-Man: Into the Spider-Verse',
year: 2018,
genre: 'Fantasy/Science Fiction',
rating: 8.7
},
{
@DominicTremblay
DominicTremblay / rest_exercise.md
Last active September 7, 2023 18:22
Creating routes according to REST

REST exercise

  • You are asked to build an API for a photo app.
  • You need to create the routes according to REST for the following actions:
  1. The end-user wants to see a list of photos

GET /photos

  1. The end-user wants to see a particular photo
<!DOCTYPE html>
<html lang="en">
<head>
<title>Results</title>
<link rel="stylesheet" href="/vendor/normalize-4.1.1.css" type="text/css" />
<link rel="stylesheet" href="/vendor/border-box.css" type="text/css" />
<link rel="stylesheet" href="/styles/layout.css" type="text/css" />
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script type="text/javascript" src="/vendor/jquery-3.0.0.js"></script>
// Array Destructuring
// Destructuring the array the conventional way
const anArray = [1, 2, 3];
const a = anArray[0];
const b = anArray[1];
const c = anArray[2];
// With ES6 Destructuring
// Array Destructuring
// Destructuring the array the conventional way
const anArray = [1, 2, 3];
const a = anArray[0];
const b = anArray[1];
const c = anArray[2];
// With ES6 Destructuring

#W1D4 - Callbacks

Content

  • First-class Objects (First-class citizen)
  • Function declaration vs function expressions
  • Higher-Order Functions
  • Callbacks

Functions as First-Class Objects

Breakout W1D1

Intro

Hey, I'm DOM

Confidence Level of a Programmer (Joke)

Confidence Level of a Programmer (joke)

@DominicTremblay
DominicTremblay / app-demo.js
Created December 12, 2018 00:35
Ajax call to weather API
$(document).ready(function() {
var cityName = 'Montreal';
var apiKey = 'put your api key here';
var url =
'https://api.openweathermap.org/data/2.5/weather?q=' +
cityName +
'&appid=' +
apiKey;
@DominicTremblay
DominicTremblay / higherFct.js
Created January 29, 2018 19:16
Breakout about higher order functions
const ancestry = [
{"name": "Emma de Milliano", "sex": "f",
"born": 1876, "died": 1956,
"father": "Petrus de Milliano",
"mother": "Sophia van Damme"},
{"name": "Carolus Haverbeke", "sex": "m",
"born": 1832, "died": 1905,
"father": "Carel Haverbeke",
"mother": "Maria van Brussel"},
{"name": "Marcus Pillus", "sex": "m",
@DominicTremblay
DominicTremblay / notes_css.md
Last active January 29, 2018 23:02
w3d1 breakout

CSS

How to add style rules to our page

  1. inline
  2. internal element
  3. external stylesheet