Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:
const Article = require('../../../../app/models/article');
Those suck for maintenance and they're ugly.
#!/bin/bash | |
git clone https://github.com/hashcat/hashcat.git | |
mkdir -p hashcat/deps | |
git clone https://github.com/KhronosGroup/OpenCL-Headers.git hashcat/deps/OpenCL | |
cd hashcat/ && make | |
./hashcat --version | |
./hashcat -b -D 1,2 | |
./example0.sh |
/** | |
* This code is licensed under the terms of the MIT license | |
* | |
* Deep diff between two object, using lodash | |
* @param {Object} object Object compared | |
* @param {Object} base Object to compare with | |
* @return {Object} Return a new object who represent the diff | |
*/ | |
function difference(object, base) { | |
function changes(object, base) { |
My experience is mostly with Java backend services in the cloud, so the advice in this post will almost certainly be biased towards this kind of error handling. But hopefully, some of it will be generally applicable and help you maintain and debug your programs in the long run.
I don't claim that these are universal best practices, but I have found these to be useful as general guidelines. As always, use your best judgment and do things that make sense in your context.
In Java, a full exception is:
An explanation of JavaScript's pass-by-value, which is unlike pass-by-reference from other languages.
var uniqueArray = function(arrArg) { | |
return arrArg.filter(function(elem, pos,arr) { | |
return arr.indexOf(elem) == pos; | |
}); | |
}; | |
var uniqEs6 = (arrArg) => { | |
return arrArg.filter((elem, pos, arr) => { | |
return arr.indexOf(elem) == pos; | |
}); |
// http://stackoverflow.com/questions/11616630/json-stringify-avoid-typeerror-converting-circular-structure-to-json/11616993#11616993 | |
var o = {}; | |
o.o = o; | |
var cache = []; | |
JSON.stringify(o, function(key, value) { | |
if (typeof value === 'object' && value !== null) { | |
if (cache.indexOf(value) !== -1) { | |
// Circular reference found, discard key | |
return; |
#!/usr/bin/env bash | |
URL="http://a0.awsstatic.com/pricing/1/ec2/ri-v2/linux-unix-shared.min.js" | |
(echo 'function callback(data) { console.log(JSON.stringify(data)); }'; curl -s "$URL") |\ | |
node |\ | |
jq -r '.config.regions[] | | |
select(.region == "us-east-1") | | |
.instanceTypes[] | | |
[ |