Skip to content

Instantly share code, notes, and snippets.

View rvigneshw's full-sized avatar
😎
Experimenting.....!

Vigneshwaran Rajasekar rvigneshw

😎
Experimenting.....!
View GitHub Profile
module.exports = {
die: function(err) {
let e = new Error();
let frame = e.stack.split("\n")[2];
let arr = frame.split(" ");
// let functionName = arr[5];
let where = arr[6].split(/[:()]/);
let fileName = where[1];
let lineNumber = where[2];
throw (err || "Died").toString().replace(/\w+:\s*/g, '') +" at "+ fileName +" line "+ lineNumber +".";
@zcaceres
zcaceres / Sequelize-Step-by-Step.md
Last active February 22, 2023 12:53
Let's get an overview of Sequelize!

Sequelize: Step-By-Step

Sequelize is a powerful library in Javascript that makes it easy to manage a SQL database. Sequelize can layer over different protocols, but here we'll use PostgreSQL. At its core, Sequelize is an Object-Relational Mapper – meaning that it maps an object syntax onto our database schemas. Sequelize uses Node.JS and Javascript's object syntax to accomplish its mapping.

Under the hood, Sequelize used with PostgreSQL is several layers removed from our actual database:

  1. First, we write our Sequelize, using Javascript objects to mimic the structure of our database tables.
  2. Sequelize creates a SQL string and passes it to a lower-level library called pg (PostgreSQL).
  3. pg connects to your PostgreSQL database and queries it or transforms its data.
  4. pg passes the data back to Sequelize, which parses and returns that data as a Javascript object.
@kevin-smets
kevin-smets / iterm2-solarized.md
Last active November 14, 2024 15:40
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k