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
const names = ['Mike', 'Matt', 'Nancy', 'Adam', 'Jenny', 'Nancy', 'Carl', 'Nancy', 'Carl'] | |
const uniq = names | |
.map((name) => { | |
return {count: 1, name: name} | |
}) | |
.reduce((a, b) => { | |
a[b.name] = (a[b.name] || 0) + b.count | |
return a | |
}, {}) |
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
Show hidden characters
{ | |
"env": { | |
"browser": true, | |
"node": true, | |
"es6": true | |
}, | |
"extends": [ | |
"eslint:recommended", | |
"plugin:react/recommended" | |
], |
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
var doc = document, | |
snapshot = doc.getElementById('snapshot'), | |
photo = snapshot.getContext('2d'), | |
video = doc.querySelector('video'), | |
VIDEO_WIDTH, VIDEO_HEIGHT, | |
computeSize = function(supportsObjectFit){ | |
// user agents that don't support object-fit | |
// will display the video with a different | |
// aspect ratio. | |
if (supportsObjectFit === true){ |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="viewport" content="width=device-width, initial-scale=0.5"> | |
<title>Oh hai.</title> | |
</head> | |
<body> | |
<video id="video" width="640" height="480" autoplay> | |
<!-- Here you can set some default video up if the camera API no worky --> | |
<source src="default.webm" type="video/webm;" codecs="vp8, vorbis"> |
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://github.com/blinks zsh theme | |
function _prompt_char() { | |
if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then | |
echo "%{%F{blue}%}±%{%f%k%b%}" | |
else | |
echo ' ' | |
fi | |
} |
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
// 1: how could you rewrite the following to make it shorter? | |
if (foo) { | |
bar.doSomething(el); | |
} else { | |
bar.doSomethingElse(el); | |
} | |