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
ffmpeg -framerate 25 -f image2 -pattern_type glob -i "*.JPG" -s:v 1920x1440 -c:v libx264 -r 25 ../timelapse.mp4 |
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 fs from 'fs'; | |
import path from 'path'; | |
import { promisify } from 'util'; | |
import puppeteer from 'puppeteer'; | |
import notifier from 'node-notifier'; | |
const readFile = promisify(fs.readFile); | |
const writeFile = promisify(fs.writeFile); | |
const SEARCH_URL = 'https://vancouver.craigslist.org/search/apa?sort=date&availabilityMode=0&max_price=3500&min_bedrooms=2&min_price=1900&postal=V5T2C2&postedToday=1&search_distance=2'; |
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
let arrived = true; | |
// Create a Promise | |
const ride = new Promise((resolve, reject) => { | |
if (arrived) { | |
resolve('driver arrived'); | |
} else { | |
reject({msg: 'rejected', code: 222}); | |
} | |
}); |
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
// https://www.youtube.com/watch?v=Wim9WJeDTHQ | |
let steps = 0; | |
const per = (num) => { | |
steps++; | |
let digits = [...String(num)].map(i => Number(i)); | |
let result = digits.reduce((acc, cur) => acc * cur); | |
if (result == 0 | |
|| String(result).length == 1 |
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
/* global localStorage */ | |
import { writable } from 'svelte/store' | |
const storage = typeof localStorage !== 'undefined' ? localStorage : { | |
removeItem: key => { if (storage[key]) { delete storage[key] } }, | |
} | |
/** | |
* Tracks storage both in `localStorage` and in svelte's `writable` stores | |
* Usage: `const name = storable('name', 'arxpoetica')` |
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
// https://www.youtube.com/watch?v=ff4fgQxPaO0 | |
/* | |
Because the JSON grammar is much simpler than JavaScript’s grammar, JSON can be | |
parsed more efficiently than JavaScript. This knowledge can be applied to improve | |
start-up performance for web apps that ship large JSON-like configuration object | |
literals (such as inline Redux stores). | |
*/ | |
const data = { foo: 42, bar: 1337 }; // 🐌 |
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
// https://blog.logrocket.com/know-your-javascript-data-structures/ | |
/* | |
* STACK | |
* LIFO - Last in, First out | |
* - Need to accept a value | |
* - Add that value to top of our Stack | |
* - Track the length of our stack to track stack's index | |
*/ |
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
/* | |
.__..__ .__ .__.. , __. | |
[__][__)[__)[__] \./ (__ | |
| || \| \| | | .__) | |
*/ | |
let arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 2, 3, 4, 5, 7, 7]; | |
/* ▀▀▀ // Shuffle array */ |
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
/* | |
.___. .. . __ .___.._..__.. . __. | |
[__ | ||\ |/ ` | | | ||\ |(__ | |
| |__|| \|\__. | _|_|__|| \|.__) | |
*/ | |
/* ▀▀▀ // Curried function */ | |
function addition(x) { | |
return function(y) { | |
return x + y; |
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
/* | |
.__ .___ __ .__..__ .__..___..__..__ __. | |
| \[__ / `| |[__)[__] | | |[__)(__ | |
|__/[___\__.|__|| \| | | |__|| \.__) | |
*/ | |
/* ▀▀▀ once() | |
once(fn): creates a version of the function that executes only once. | |
It’s useful for an initialization function, where we want to make sure it | |
runs only once, no matter how many times it is called from different places. |
NewerOlder