Skip to content

Instantly share code, notes, and snippets.

View saifsmailbox98's full-sized avatar
💣
Cooking The Grenade

Saif Ur Rahman saifsmailbox98

💣
Cooking The Grenade
View GitHub Profile

You first need to insert the item to the end of the array arr using the method push() on the array arr. And then remove and return the first element of the array using shift() method on the array arr.

  • push(): Add items to then end of an array. push() returns the new array length.
  • shift(): Remove an item from the beginning of an array. shift() returns the removed item.
  • pop(): Remove an item from the end of an array. pop() returns the removed item.
  • unshift(): Add items to the beginning of an array. unshift() returns the new array length.
var obj = {

"name" : "Saif",
"username" : "saifsmailbox98"

}; //object

Use the escape sequence from the table on the following sentence:

FirstLinenewline backslashSecondLinebackslash carriage-returnThirdLine

newline \n
backslash \\
carriage-return \r

Make a new folder (aka directory)

$ mkdir <FOLDERNAME>

Navigate into an existing folder (aka change directory)

$ cd <FOLDERNAME>

List the items in a folder

$ ls

Turn Git on for a folder

$ git init

Check status of changes to a repository

$ git status

$ node -pe "require('url').parse('/test?q=1', true)"

Url {
  protocol: null,
  slashes: null,
  auth: null,
  host: null,
  port: null,
  hostname: null,
 hash: null,
$ npm install jade --save
npm ERR! Linux 4.9.17-c9
npm ERR! argv "/home/ubuntu/.nvm/versions/node/v4.1.2/bin/node" "/home/ubuntu/.nvm/versions/node/v4.1.2/bin/npm" "install" "jade" "--save"
npm ERR! node v4.1.2
npm ERR! npm  v2.14.4
npm ERR! code ECONNREFUSED
npm ERR! errno ECONNREFUSED
npm ERR! syscall connect
Name Value
ONE HUNDRED 100
TWENTY 20
TEN 10
FIVE 5
ONE 1
QUARTER 0.25
DIME 0.10
# RN # RN # RN # RN # RN # RN # RN # RN # RN # RN
1 I 11 XI 21 XXI 31 XXXI 41 XLI 51 LI 61 LXI 71 LXXI 81 LXXXI 91 XCI
2 II 12 XII 22 XXII 32 XXXII 42 XLII 52 LII 62 LXII 72 LXXII 82 LXXXII 92 XCII
3 III 13 XIII 23 XXIII 33 XXXIII 43 XLIII 53 LIII 63 LXIII 73 LXXIII 83 LXXXIII 93 XCIII
4 IV 14 XIV 24 XXIV 34 XXXIV 44 XLIV 54 LIV 64 LXIV 74 LXXIV 84 LXXXIV 94 XCIV
5 V 15 XV 25 XXV
var express = require("express");
var path = require("path");
var app = express();
var filePath = path.join(__dirname, "celine.jpg");
app.use(function(req, res, next){
res.sendFile(filePath, function(err){
if(err){
var mongo = require('mongodb').MongoClient
var age = process.argv[2]
var url = 'mongodb://localhost:27017/learnyoumongo'
mongo.connect(url, function(err, db) {
if (err) throw err
var parrots = db.collection('parrots')
parrots.find({
age: {