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
# INSTALL
# cp tmuxconf ~/.tmux.conf
#
# Set prefix key to c-f instead of default c-b
unbind C-b
set -g prefix C-f
bind C-f send-prefix
set-option -g default-shell /bin/zsh
@RickJP
RickJP / gist:b3491b5e84126684521d1631c6816802
Last active November 24, 2019 02:16
CORE -> FLUTTER - SETUP ON MAC
FLUTTER
MacOS install
Download SDK
cd ~/development
$ unzip ~/Downloads/flutter_macos_v1.7.8+hotfix.3-stable.zip
export PATH="$PATH:`pwd`/flutter/bin"
@RickJP
RickJP / gist:b880047ea275bf6084c4b97414739c1a
Created November 24, 2019 02:13
JS - Measuring Performance
JS - Measuring JavaScript Functions’ Performance
Performance has always played a crucial part in software. On the web, performance is even more important as our users can easily change website and visit one of our competitors if we offer them slow pages. As professional web developers, we have to take this issue into account. A lot of old web performance optimization best practices, such as minimizing requests, using a CDN and not writing rendering blocking code, still apply today. However, as more and more web apps are using JavaScript, it’s important to verify that our code is fast.
Suppose that you have a working function but you suspect it’s not as fast as it could be, and you have a plan to improve it. How do you prove this assumption? What’s the best practice for testing the performance of JavaScript functions today? Generally, the best way to achieve this task is to use the built-in performance.now() function and measure the time before and after your function executes.
In this article we’ll discuss h
@RickJP
RickJP / gist:081823bbaed4686d1355e25564a0d72a
Created November 24, 2019 01:59
VS CODE - JS ES6 Config Settings
VISUAL STUDIO CODE - SETTINGS JSCONFIG
{
  "compilerOptions": {
      "outDir": "build/dist",
      "module": "commonjs",
      "target": "es5",
      "lib": ["es6", "dom"],
      "sourceMap": true,
      "jsx": "react",
@RickJP
RickJP / gist:862aaf7c8d4bc03f73d71cfa21b4bca6
Created November 24, 2019 01:52
CORE => LINUX - MASTER THE COMMANDS
CORE => LINUX TERMINAL, MAC
MASTER THE COMMANDS
TERMINAL SHORCUTS CHEATSHEET
https://github.com/0nn0/terminal-mac-cheatsheet
KILL PROCESS
killall appname
kill PID
Common File Permissions
Setting Numerical Meaning
-rw------- (600) Only the owner has read and write permissions.
-rw-r--r-- (644) Only the owner has read and write permissions; the group and others have read only.
-rwx------ (700) Only the owner has read, write, and execute permissions.
-rwxr-xr-x (755) The owner has read, write, and execute permissions; the group and others have only read and execute.
-rwx--x--x (711) The owner has read, write, and execute permissions; the group and others have only execute.
-rw-rw-rw- (666) Everyone can read and write to the file. (Be careful with these permissions.)
-rwxrwxrwx (777) Everyone can read, write, and execute. (Again, this permissions setting can be hazardous.)
@RickJP
RickJP / gist:28f8f803bcd942023aeb1e2eeaf44411
Created November 24, 2019 01:50
CORE => SETUP NGINX AS WEB SERVER & APACHE AS REVERSE PROXY
CORE => UBUNTU ON LIGHTSAIL - NGINX AS WEB SERVER & REVERSE PROXY FOR APACHE
sudo ufw enable
sudo ufw allow OpenSSH
INSTALL APACHE & PHP-FPM
sudo apt update
sudo apt install apache2 php-fpm
wget https://mirrors.edge.kernel.org/ubuntu/pool/multiverse/liba/libapache-mod-fastcgi/libapache2-mod-fastcgi_2.4.7~0910052141-1.2_amd64.deb
@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
@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: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];
}
}