Skip to content

Instantly share code, notes, and snippets.

View raulmoyareyes's full-sized avatar
💻
Programming!

Raúl Moya Reyes raulmoyareyes

💻
Programming!
View GitHub Profile
@raulmoyareyes
raulmoyareyes / iterm2.md
Created November 30, 2019 18:03 — forked from squarism/iterm2.md
iterm2 cheatsheet

Tabs and Windows

Function Shortcut
New Tab + T
Close Tab or Window + W (same as many mac apps)
Go to Tab + Number Key (ie: ⌘2 is 2nd tab)
Go to Split Pane by Direction + Option + Arrow Key
Cycle iTerm Windows + backtick (true of all mac apps and works with desktops/mission control)
(function (context, trackingId, options) {
const history = context.history;
const doc = document;
const nav = navigator || {};
const storage = localStorage;
const encode = encodeURIComponent;
const pushState = history.pushState;
const typeException = 'exception';
const generateId = () => Math.random().toString(36);
const getId = () => {
@raulmoyareyes
raulmoyareyes / dip.js
Last active July 29, 2018 16:58
Dependency Inversion Principle
class Ingredient {
// implementation
}
class Milk extends Ingredient {
// implementation
}
class Beverage {
constructor(ingredient) {
@raulmoyareyes
raulmoyareyes / wrong-dip.js
Last active July 29, 2018 16:59
[ Wrong ] - Dependency Inversion Principle
class Milk {
// implementation
}
class Coffee {
constructor(milk) {
this.milk = milk
}
cost() {
@raulmoyareyes
raulmoyareyes / isp.ts
Created July 29, 2018 16:32
Interface Segregation Principle TS
class Car {
startEngine() {}
accelerate() {}
}
class Seat extends Car {
startEngine() {
// start engine...
}
accelerate() {
@raulmoyareyes
raulmoyareyes / wrong-isp.js
Created July 29, 2018 16:32
[ Wrong ] - Interface Segregation Principle
class Car {
startEngine() {}
accelerate() {}
backToThePast() {}
backToTheFuture() {}
}
class Seat extends Car {
startEngine() {
// start engine...
@raulmoyareyes
raulmoyareyes / isp.js
Last active July 29, 2018 16:33
Interface Segregation Principle
class Car {
startEngine() {}
accelerate() {}
}
class Seat extends Car {
startEngine() {
// start engine...
}
accelerate() {
@raulmoyareyes
raulmoyareyes / lsp.js
Created July 29, 2018 15:50
Liskov Substitution Principle
class Rectangle {
constructor(width, height) {
this.width = width;
this.height = height;
}
getArea() {
return this.width * this.height;
}
}
@raulmoyareyes
raulmoyareyes / wrong-lsp.js
Created July 29, 2018 15:48
[ Wrong ] - Liskov Substitution Principle
class Rectangle {
constructor() {
this.width = 0;
this.height = 0;
}
setWidth(width) {
this.width = width;
}
@raulmoyareyes
raulmoyareyes / ocp.js
Last active July 29, 2018 15:45
Open / Closed Principle
class Printable {
function print() {
// ...
}
}
class Pdf extends Printable {
constructor(name, size) {
super();
this.name = name;
this.size = size;