It's better to fail with your own error than undefined is not a function
.
A simple assertion solution would let your application fail early and fail at the right point in runtime execution. Allowing you to handle it better.
########################################## | |
# To run: | |
# curl -sSL https://gist.githubusercontent.com/andrewelkins/1adc587feb610f586f8f40b50b7efc3a/install-docker-on-linux-mint-18.sh | bash -x | |
########################################## | |
# Kernel version http://stackoverflow.com/a/4024263 | |
versionlte() { | |
[ "$1" = "`echo -e "$1\n$2" | sort -V | head -n1`" ] | |
} | |
versionlt() { |
#!/usr/bin/env node | |
console.log('v6', process.argv, process.cwd(), __dirname); | |
const {exec} = require('child_process'); | |
const path = require('path'); | |
exec('npm bin', {cwd: __dirname}, (err, stdout, stderr) => { | |
if (err) { | |
console.error(err); | |
} else { |
<button id="btn">Click me!</button> | |
<script> | |
var btn = document.getElementById('btn'); | |
btn.onclick = function() { | |
// will be overwritten! | |
console.log('[onclick] foo'); | |
} |
Using xclip to copy terminal content to the clip board:
Say you want to pipe shell output to your clipboard on Linux. How would you do it? First, choose the clipboard destination, either the Mouse clip or the system clipboard.
For the mouse clipboard, pipe straight to xclip:
echo 123 | xclip
For the system clip board, pipe to xclip and select clip directly:
A complete list of RxJS 5 operators with easy to understand explanations and runnable examples.
// List all files in a directory in Node.js recursively in a synchronous fashion | |
var walkSync = function(dir, filelist) { | |
var fs = fs || require('fs'), | |
files = fs.readdirSync(dir); | |
filelist = filelist || []; | |
files.forEach(function(file) { | |
if (fs.statSync(dir + file).isDirectory()) { | |
filelist = walkSync(dir + file + '/', filelist); | |
} | |
else { |
// connect() is a function that injects Redux-related props into your component. | |
// You can inject data and callbacks that change that data by dispatching actions. | |
function connect(mapStateToProps, mapDispatchToProps) { | |
// It lets us inject component as the last step so people can use it as a decorator. | |
// Generally you don't need to worry about it. | |
return function (WrappedComponent) { | |
// It returns a component | |
return class extends React.Component { | |
render() { | |
return ( |
I was at Amazon for about six and a half years, and now I've been at Google for that long. One thing that struck me immediately about the two companies -- an impression that has been reinforced almost daily -- is that Amazon does everything wrong, and Google does everything right. Sure, it's a sweeping generalization, but a surprisingly accurate one. It's pretty crazy. There are probably a hundred or even two hundred different ways you can compare the two companies, and Google is superior in all but three of them, if I recall correctly. I actually did a spreadsheet at one point but Legal wouldn't let me show it to anyone, even though recruiting loved it.
I mean, just to give you a very brief taste: Amazon's recruiting process is fundamentally flawed by having teams hire for themselves, so their hiring bar is incredibly inconsistent across teams, despite various efforts they've made to level it out. And their operations are a mess; they don't real
################### | |
# compiled source # | |
################### | |
*.com | |
*.class | |
*.dll | |
*.exe | |
*.pdb | |
*.dll.config | |
*.cache |