Skip to content

Instantly share code, notes, and snippets.

View bgoonz's full-sized avatar
🎯
learning

Bryan C Guner bgoonz

🎯
learning
View GitHub Profile
# ------------------------------------------------------------------------------
# ---------------------------- general shortcuts--------------------------------
# ------------------------------------------------------------------------------
# -- easy reverse cd --
alias .1='cd ..'
alias .2='cd ../../'
alias .3='cd ../../../'
alias .4='cd ../../../../'
file_specification() {
FILE_NAME="$(basename "${entry}")"
DIR="$(dirname "${entry}")"
NAME="${FILE_NAME%.*}"
EXT="${FILE_NAME##*.}"
SIZE="$(du -sh "${entry}" | cut -f1)"
printf "%*s${GRE}%s${NCL}\n" $((indent+4)) '' "${entry}"
printf "%*s\tFile name:\t${YEL}%s${NCL}\n" $((indent+4)) '' "$FILE_NAME"
printf "%*s\tDirectory:\t${YEL}%s${NCL}\n" $((indent+4)) '' "$DIR"
@bgoonz
bgoonz / pipenv_cheat_sheet.md
Created February 19, 2021 07:01 — forked from bradtraversy/pipenv_cheat_sheet.md
Pipenv cheat sheet for common commands

Pipenv Cheat Sheet

Install pipenv

pip3 install pipenv

Activate

pipenv shell

Heroku is an web application that makes deploying applications easy for a beginner.

Before you begin deploying, make sure to remove any console.log's or debugger's in any production code. You can search your entire project folder if you are using them anywhere.

You will set up Heroku to run on a production, not development, version of your application. When a Node.js application like yours is pushed up to Heroku, it is identified as a Node.js application because of the package.json file. It runs npm install automatically. Then, if there is a heroku-postbuild script in the package.json file, it will run that script. Afterwards, it will automatically run npm start.

In the following phases, you will configure your application to work in production, not just in development, and configure the package.json scripts for install, heroku-postbuild and start scripts to install, build your React application, and start the Express production server.

const {lstatSync, readdirSync} = require('fs');
const {basename, join, resolve} = require('path');
const denyList = ['images'];
const isDirectory = (source) => lstatSync(source).isDirectory();
const getDirectories = (source) =>
readdirSync(source)
.map((name) => join(source, name))
.filter(isDirectory);
const fs=require('fs');
let cat= require( 'child_process' ).execSync( 'cat *' ).toString( 'UTF-8' )
fs.writeFile( 'output.md', cat, ( err ) => {
// In case of a error throw err.
if ( err ) throw err;
} );
## Selectors
**Universal Selector** * {}
**ID Selector** #id {}
**Class Selector**.class {}
**Type Selector**h1, h2 ,h3 {}
**Adjacent Sibling Selector**h1 + p {}
**Child Selector**ul > li {}
**General Sibling Selector** h1 ~ p {}
**Descendant Selector**p a {}

Binary Tree

Tree Nodes

class TreeNode {
  constructor(val) {
    this.val = val;
    this.left = null;
    this.right = null;
  }

===========================

PostgreSQL commands

===========================

Access the PostgreSQL server from psql with a specific user: psql -U [username]; Connect to a specific database:\c database_name;
To quit the psql:\q List all databases in the PostgreSQL database server\l
List all schemas:\dn List all stored procedures and functions:\df
List all views:\dv Lists all tables in a current databas

Shellscripts

  1. newbranch $1 >> creates new git branch
  2. cm $1 >> # add, commit with message, push to repo and clr terminal
  3. ghmov $1>> removes and adds orgin
  4. dwnDir* >> opens the file explorer

Shell Aliases