Common Tools for development in Mac
- version
xcode-select --version
// xcode-select version 2392.- Install
| /** | |
| * Example `FizzBuzz` with JavaScript (Pattern-Matching Like????????????) λ_(ツ)_/¯ | |
| * I Love this tweet | |
| * @see https://twitter.com/cajuinaoverflow/status/1395022027204005889 | |
| * JavaScript will make You Crazy (Trust Me!) | |
| */ | |
| const FizzBuzz = n => ({ | |
| true: n, | |
| [ n % 5 === 0]: "Buzz", | |
| [ n % 3 === 0]: "Fizz", |
| /** | |
| * Sets up a DOM MutationObserver that watches for elements using undefined CSS | |
| * class names. Performance should be pretty good, but it's probably best to | |
| * avoid using this in production. | |
| * | |
| * Usage: | |
| * | |
| * import cssCheck from './checkForUndefinedCSSClasses.js' | |
| * | |
| * // Call before DOM renders (e.g. in <HEAD> or prior to React.render()) |
| 'use strict'; | |
| /** | |
| * @callback BeforeShutdownListener | |
| * @param {string} [signalOrEvent] The exit signal or event name received on the process. | |
| */ | |
| /** | |
| * System signals the app will listen to initiate shutdown. | |
| * @const {string[]} |
| [ | |
| { | |
| "id": "259392830932254721", | |
| "name": "SpeedRunners", | |
| "icon": "cb48279ea90e86fb4f71c709d3236395", | |
| "splash": "94e91cac9509fee1eb80a69b9503878a", | |
| "overlay": false, | |
| "overlayWarn": false, | |
| "overlayCompatibilityHook": false, | |
| "aliases": [], |
| // exemple based on https://github.com/diafygi/webcrypto-examples#rsa-oaep | |
| function importKey() { | |
| return window.crypto.subtle.importKey( | |
| "jwk", //can be "jwk" or "raw" | |
| { //this is an example jwk key, "raw" would be an ArrayBuffer | |
| kty: "oct", | |
| k: "Y0zt37HgOx-BY7SQjYVmrqhPkO44Ii2Jcb9yydUDPfE", | |
| alg: "A256GCM", | |
| ext: true, |
https://gist.github.com/ljharb/58faf1cfcb4e6808f74aae4ef7944cff
While attempting to explain JavaScript's reduce method on arrays, conceptually, I came up with the following - hopefully it's helpful; happy to tweak it if anyone has suggestions.
JavaScript Arrays have lots of built in methods on their prototype. Some of them mutate - ie, they change the underlying array in-place. Luckily, most of them do not - they instead return an entirely distinct array. Since arrays are conceptually a contiguous list of items, it helps code clarity and maintainability a lot to be able to operate on them in a "functional" way. (I'll also insist on referring to an array as a "list" - although in some languages, List is a native data type, in JS and this post, I'm referring to the concept. Everywhere I use the word "list" you can assume I'm talking about a JS Array) This means, to perform a single operation on the list as a whole ("atomically"), and to return a new list - thus making it mu
| package goddrinksjava; | |
| /** | |
| * The program GodDrinksJava implements an application that | |
| * creates an empty simulated world with no meaning or purpose. | |
| * | |
| * @author momocashew | |
| * @lyrics hibiyasleep | |
| */ | |
This is a more precise version of the native setTimeout(). It uses the same parameters as setTimeout, but adds a third parameter "resolution" which defines how often (in ms) to check for the time that passed.
// alert after 5 seconds with an inaccuracy of 20 milliseconds
var timeout = setExactTimeout(function(){
alert('done');
}, 5000, 20);
// comment out to show "done"
clearExactTimeout(timeout);