Skip to content

Instantly share code, notes, and snippets.

View RickJP's full-sized avatar
🏠
Working from home

Rick RickJP

🏠
Working from home
View GitHub Profile
const euros = [ 29.76, 41.85, 46.5 ];
euros.forEach((val) => {
// console.log(val);
});
const total = euros.reduce((total, amount) => {
total += amount;
return total;
});
@RickJP
RickJP / gist:c9c88f943997327eea875eb060af10a0
Created April 10, 2019 04:22
JS - minMax (Return the min and max value in one return statement using reduce)
function minMax(items) {
return items.reduce((acc, val) => {
acc[0] = acc[0] === undefined || val < acc[0] ? val : acc[0];
acc[1] = acc[1] === undefined || val > acc[1] ? val : acc[1];
console.log(acc);
return acc;
}, []);
}
console.log(minMax([ 3, 98, 1, 6, 100 ]));
#################### LINTER GIVES ERROR FOR pg.init() ###########################
For VS CODE Open settings.json
Search for python.linting.mypyArgs
ADD THIS:
"python.linting.pylintArgs": [
"----extension-pkg-whitelist=1xml"
@RickJP
RickJP / MAC-TERMINAL
Created November 4, 2018 04:40
MAC-TERMINAL - Useful Commands & Solutions
################### Find (and kill) process locking port 3000 on Mac ##########################
You can try netstat
netstat -vanp tcp | grep 3000
For macOS El Capitan and newer (or if your netstat doesn't support -p), use lsof
sudo lsof -i tcp:3000
#######################################################################################
@RickJP
RickJP / ERROR-MYSQL
Created November 4, 2018 04:36
ERROR: MySQL 8.0 - Client does not support authentication protocol requested by server; consider upgrading MySQL client
Execute the following query in MYSQL Workbench
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'
Try connecting using node after you do so
@RickJP
RickJP / TRAVERSY_BOOTSTRAP-SIZING
Last active November 4, 2018 04:34
Sizing For Bootstrap
<!-- WIDTH CLASSES -->
<div class="bg-success p-3 w-25">Width 25%</div>
<div class="bg-success p-3 w-50">Width 50%</div>
<div class="bg-success p-3 w-75">Width 75%</div>
<div class="bg-success p-3 w-100">Width 100%</div>
<div class="bg-success p-3 w-auto">Width Auto</div>
<br>
<br>
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->