This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git show some_commit_sha1 -- some_file | git apply -R |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const input = ["[[)}", "{()}"] | |
const balanceBrackets = arr => { | |
const result = arr.map(string => { | |
const stack = []; | |
const map = { | |
'(': ')', | |
'[': ']', | |
'{': '}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Sort an Array of Objects by a different sorting Array | |
const sortedList = ['alice', 'clara', 'bob']; | |
const people = [{ | |
name: 'alice', | |
age: 101 | |
}, { | |
name: 'bob', | |
age: -10 | |
}, { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker images purge | |
docker system prune -a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lsof -wni tcp:3000 | |
kill -9 <server #> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import { observer, inject } from 'mobx-react'; | |
import MapGL, { Marker, FlyToInterpolator } from 'react-map-gl'; | |
import token from '../../../Creds/Creds'; | |
import moment from 'moment' | |
if (!token) { | |
throw new Error('That token is bad'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (let i = 0; i < 101; i++){ | |
let output = ''; | |
if (i % 3 === 0) output = "Fizz" | |
if (i % 5 === 0) output += "Buzz" | |
console.log(output || i) | |
}; | |
for(i=0;i<100;)console.log((++i%3?'':'Fizz')+(i%5?'':'Buzz')||i) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SOLID | |
Single Responsibility Principle - class should have one job | |
Open Closed Principle - Objects should be OPEN for extension but closed for modification | |
Liskov Substitution Principle - can a subtype substitute for a base type | |
-- if S is a subtype of T, then objects of type T may be replaced with objects of type S | |
Interface Segregation Principle - “many client-specific interfaces are better than one general-purpose interface--no client should be forced to depend on methods it does not use | |
Dependency Inversion Principle - High-level modules should not depend on low-level modules. Both should depend on abstractions. | |
///////////////////////////////////////////// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// What is a class? | |
- They hold data | |
- They have methods that interact with that data | |
- They instantiate objects | |
// What is an object? | |
- An instance of a class | |
- Classes descend from the Object root class | |
// What is a module? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Make great software and the tooling and learning will come. | |
// Event Delegation | |
An event listener is fired on all child elements (event bubbling) | |
An event listener is fired on all parent elements (bubble up) | |
Target is what was actually clicked | |
Current Target is what the event listener is attached to | |
/////////////////////////////////////////////////////////// |