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
# 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 ->
@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>
@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 / 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
#######################################################################################
#################### 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 / 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 ]));
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:3a024545b68f6585447440a135fc97a9
Created April 10, 2019 12:40
JS - Roman Numeral <-> Number Converter
function romanize(num) {
var lookup = {M:1000,CM:900,D:500,CD:400,C:100,XC:90,L:50,XL:40,X:10,IX:9,V:5,IV:4,I:1},
roman = '',
i;
for ( i in lookup ) {
while ( num >= lookup[i] ) {
roman += i;
num -= lookup[i];
}
}
@RickJP
RickJP / gist:99155be0a3a196dbf24668437b565034
Created April 10, 2019 12:42
JS - Reverse lookup object with array
resourceMap = {
"a": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
"b": [11, 12],
"c": [21, 23],
"d": [54, 55, 56, 57, 510]
};
var reverseMap = {};
for(var propName in resourceMap)
{
@RickJP
RickJP / gist:74608674608c63844d378a9342f41cdd
Created November 24, 2019 01:47
CORE => SETUP LAMP STACK ON UBUNTU
CORE => UBUNTU - ESSENTIALS STEPS
================================================================
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Offending ECDSA key in /Users/rick/.ssh/known_hosts:5
READ LINE TO CONFIRM