- Install iTerm2 from https://www.iterm2.com/
- Install oh-my-zsh from https://ohmyz.sh/ or https://github.com/robbyrussell/oh-my-zsh
- Set iTerm2 theme tab theme to Dark -
Preferences | Appearance | Tabs | Theme > Dark
- Install Fira Code fonts from https://github.com/tonsky/FiraCode (Clone and navigate to
dstr > ttf
, install all font files by double clicking) - Install Powerline fonts from https://github.com/powerline/fonts
- Set fonts for iTerm2 -
Preferences | Profiles | Text
- Change
Font
to14pt Fira code regular
and CheckUse Ligatures
checkbox - Change
Non ASCII Font
to14pt Fira mono
and CheckUse Ligatures
checkbox
- Change
- Install iTerm2 snazzy theme from https://github.com/sindresorhus/iterm2-snazzy
- Navigate to
Preferences | Profiles | Color Presets > Snazzy
- Navigate to
This file contains hidden or 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 message = bottle.fullOfSoda | |
? 'The bottle has soda!' | |
: 'The bottle may not have soda :-(' | |
// is the same as | |
let message | |
if (bottle.fullOfSoda) { | |
message = 'The bottle has soda!' | |
} else { | |
message = 'The bottle may not have soda :-(' |
This file contains hidden or 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 greeting = 'Hello' | |
const subject = 'World' | |
console.log(`${greeting} ${subject}!`) // Hello World! | |
// Yukarıdakinin aynısı: | |
console.log(greeting + ' ' + subject + '!') | |
// React ile: | |
function Box({className, ...props}) { | |
return <div className={`box ${className}`} {...props} /> |
This file contains hidden or 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 a = 'hello' | |
const b = 42 | |
const c = {d: [true, false]} | |
console.log({a, b, c}) | |
// Yukarıdakinin aynısı: | |
console.log({a: a, b: b, c: c}) | |
// React ile: | |
function Counter({initialCount, step}) { |
This file contains hidden or 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 arr = [5, 6, 8, 4, 9] | |
Math.max(...arr) | |
// is the same as | |
Math.max.apply(null, arr) | |
const obj1 = { | |
a: 'a from obj1', | |
b: 'b from obj1', | |
c: 'c from obj1', | |
d: { |
This file contains hidden or 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
function promises() { | |
const successfulPromise = timeout(100).then(result => `success: ${result}`) | |
const failingPromise = timeout(200, true).then(null, error => | |
Promise.reject(`failure: ${error}`), | |
) | |
const recoveredPromise = timeout(300, true).then(null, error => | |
Promise.resolve(`failed and recovered: ${error}`), | |
) |
This file contains hidden or 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
// add(1) | |
// add(1, 2) | |
function add(a, b = 0) { | |
return a + b | |
} | |
// is the same as | |
const add = (a, b = 0) => a + b | |
// is the same as |
This file contains hidden or 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
export default function add(a, b) { | |
return a + b | |
} | |
/* | |
* import add from './add' | |
* console.assert(add(3, 2) === 5) | |
*/ | |
export const foo = 'bar' |
This file contains hidden or 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
function nestedArrayAndObject() { | |
// refactor this to a single line of destructuring... | |
const info = { | |
title: 'Once Upon a Time', | |
protagonist: { | |
name: 'Emma Swan', | |
enemies: [ | |
{name: 'Regina Mills', title: 'Evil Queen'}, | |
{name: 'Cora Mills', title: 'Queen of Hearts'}, | |
{name: 'Peter Pan', title: `The boy who wouldn't grow up`}, |
This file contains hidden or 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 obj = {x: 3.6, y: 7.8} | |
// makeCalculation(obj) | |
function makeCalculation({x, y: d, z = 4}) { | |
return Math.floor((x + d + z) / 3) | |
} | |
// Yukarıdakinin aynısı: | |
function makeCalculation(obj) { | |
const {x, y: d, z = 4} = obj |
NewerOlder