$ docker
PS1='\[\033]0;WSL2 Bash\W\007\]' # set window title | |
PS1="$PS1"'\n' # new line | |
PS1="$PS1"'\[\033[36m\]' # change to green | |
PS1="$PS1"'bash@bexgboost ' # user@host<space> | |
PS1="$PS1"'\[\033[31m\]' # change to brownish yellow | |
PS1="$PS1"'\W' # current working directory | |
source /usr/lib/git-core/git-sh-prompt | |
export PS1="${debian_chroot:+($debian_chroot)}\[\033[01;36m\]\u:\[\033[01;31m\]\w\[\033[33m\]\$(__git_ps1)\[\033[33m\]" |
// Thoroughly untested. | |
let searchTerms = ['law', 'software', 'news', 'health']; | |
let elems = document.querySelectorAll("h1, h2, h3, h4, h5, h6, li, p, a") | |
for (let i = 0, total = elems.length; i < total; i++) { | |
let element = elems[i]; | |
if (element && element.innerText) { | |
let innerText = element.innerText; | |
for (let j = 0; j < searchTerms.length; j++) { |
/* | |
Problem: | |
['Tokyo', 'London', 'Rome', 'Donlon', 'Kyoto', 'Paris'] | |
// YOUR ALGORITHM |
'use strict'; | |
// Dependencies | |
const gcloud = require('google-cloud', { | |
projectId: 'sara-bigquery', | |
keyfileName: 'keyfile.json' | |
}); | |
const vision = gcloud.vision(); | |
const fs = require('fs'); | |
const async = require('async'); |
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
if (typeof window.getComputedStyle(document.body).mixBlendMode === 'undefined') { | |
document.documentElement.className += " mix-blend-mode-no"; | |
} |
"use strict"; | |
var React = require('react'); | |
var Select = React.createClass({ | |
propTypes: { | |
name: React.PropTypes.string.isRequired, | |
label: React.PropTypes.string.isRequired, | |
onChange: React.PropTypes.func.isRequired, |
// String utils | |
// | |
// resources: | |
// -- mout, https://github.com/mout/mout/tree/master/src/string | |
/** | |
* "Safer" String.toLowerCase() | |
*/ | |
function lowerCase(str) { | |
return str.toLowerCase(); |