Skip to content

Instantly share code, notes, and snippets.

@vaibhavdshinde
vaibhavdshinde / walksync.js
Created December 7, 2020 11:59 — forked from kethinov/walksync.js
List all files in a directory in Node.js recursively in a synchronous fashion
// List all files in a directory in Node.js recursively in a synchronous fashion
var walkSync = function(dir, filelist) {
var fs = fs || require('fs'),
files = fs.readdirSync(dir);
filelist = filelist || [];
files.forEach(function(file) {
if (fs.statSync(dir + file).isDirectory()) {
filelist = walkSync(dir + file + '/', filelist);
}
else {
@vaibhavdshinde
vaibhavdshinde / better-nodejs-require-paths.md
Created October 17, 2020 14:18 — forked from branneman/better-nodejs-require-paths.md
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@vaibhavdshinde
vaibhavdshinde / notes.md
Created October 14, 2020 12:00 — forked from markgk629/notes.md
Basic C programming

Summary notes for lecture of course cs1911 - UNSW

Week 1

Assessment

  1. Tutorial and Lab work - 10%
@vaibhavdshinde
vaibhavdshinde / 1 - sql_interview_questions.md
Created October 9, 2020 19:52 — forked from mjhea0/1 - sql_interview_questions.md
Jitbit's SQL interview questions
@vaibhavdshinde
vaibhavdshinde / exercise.md
Created October 6, 2020 07:30 — forked from RitRa/exercise.md
MongoDB Practice

MongoDB Practice

MongoDB Exercise in mongo shell

create database

Connect to a running mongo instance, use a database named mongo_practice. use mongo_practice

Insert Documents

Interview Questions

MongoDB

Q1: Explain what is MongoDB? ☆

Answer: MongoDB is an open-source document database that provides high performance, high availability, and automatic scaling. It's Key Features are:

  • Document Oriented and NoSQL database.
@vaibhavdshinde
vaibhavdshinde / exercise.md
Created October 5, 2020 22:15 — forked from theRemix/exercise.md
MongoDB Practice

MongoDB Practice

MongoDB Exercise in mongo shell

Connect to a running mongo instance, use a database named mongo_practice.

Document all your queries in a javascript file to use as a reference.

Insert Documents

@vaibhavdshinde
vaibhavdshinde / README.md
Created October 5, 2020 21:30 — forked from joyrexus/README.md
Node.js streams demystified

A quick overview of the node.js streams interface with basic examples.

This is based on @brycebaril's presentation, Node.js Streams2 Demystified

Overview

Streams are a first-class construct in Node.js for handling data.

Think of them as as lazy evaluation applied to data.