sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
- Download zsh-autosuggestions by
#!/bin/bash | |
echo "LC_ALL=en_US.UTF-8" | sudo tee -a /etc/environment | |
echo "en_US.UTF-8 UTF-8" | sudo tee -a /etc/locale.gen | |
echo "LANG=en_US.UTF-8" | sudo tee -a /etc/locale.conf | |
sudo locale-gen en_US.UTF-8 |
import React, { useEffect, useRef, FunctionComponent, HTMLProps } from 'react'; | |
import 'intersection-observer'; // if you want to include a polyfill | |
/** | |
* Returns an IntersectionObserver that loads the image | |
* when it is at least {threshold}*100 visible in the viewport. | |
* | |
* PS: Cached on the window for performance | |
*/ | |
function getImageLoaderObserver( |
function Let(f) { | |
let called = false | |
let v = null | |
return function () { | |
if(called) return v | |
console.log('evaluating.') | |
v = f() | |
called = true | |
return v | |
} |
package main | |
import ( | |
"fmt" | |
"os" | |
"time" | |
) | |
type Pomodoro struct { | |
turnChan, shortBreakChan, longBreakChan, exit chan bool |
#!/bin/bash | |
# Small utility to wait for port to open. | |
# | |
# usage: | |
# ./port-wait.sh hostname port [timeout=10] | |
# | |
# ex: | |
# ./port-wait.sh 127.0.0.1 3000 |
#!/bin/sh | |
# | |
# Check for ruby style errors | |
red='\033[0;31m' | |
green='\033[0;32m' | |
yellow='\033[0;33m' | |
NC='\033[0m' | |
if git rev-parse --verify HEAD >/dev/null 2>&1 |
Install the React Developer Tools Chrome Extension.
Go to the egghead website, i.e. Getting Started with Redux
Click View -> Developer -> Javascript Console
, then the React
tab, then the <NextUpLessonList ...>
tag.
Click back to the Console
tab, then run:
require 'benchmark' | |
iterations = 1_000_000 | |
words = 'foo, bar, test, boo'.split(',').map(&:strip) | |
string = 'this is going foo be awesome~!' | |
Benchmark.bmbm do |bm| | |
bm.report do | |
iterations.times do | |
words.any? { |s| string.include?(s) } | |
end |