Skip to content

Instantly share code, notes, and snippets.

@Omkaragrawal
Omkaragrawal / Solution.js
Created May 18, 2020 13:42
Solution to HakerRank Inheritance Tutorials of/in 10 Days of Javascript
class Rectangle {
constructor(w, h) {
this.w = w;
this.h = h;
}
}
/*
* Write code that adds an 'area' method to the Rectangle class' prototype
*/
@Omkaragrawal
Omkaragrawal / Problematic-Code.js
Created May 18, 2020 13:31
Problematic-code.js file
class Rectangle {
constructor(w, h) {
this.w = w;
this.h = h;
}
}
/*
* Write code that adds an 'area' method to the Rectangle class' prototype
*/
@Omkaragrawal
Omkaragrawal / Details.markdown
Created May 18, 2020 13:28
HakerRank tutorials 10DaysofJavascript Inheritance

Problem Statement

Medium Article to understand the problem and the solution.

Below are two files:

  • Problematic-code.js : This was the code that I had submitted but was not working.
  • Solution.js : This is the actual working code that I have submitted.
@Omkaragrawal
Omkaragrawal / postgres-cheatsheet.md
Created December 31, 2018 13:18 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@Omkaragrawal
Omkaragrawal / chatbot.py
Created September 29, 2018 05:51
Chat bot
import pandas as pd
import numpy as np
import seaborn as sns
sns.set(style='white')
import matplotlib.pyplot as plt
from sklearn.preprocessing import LabelEncoder
from sklearn.cross_validation import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import KFold
@Omkaragrawal
Omkaragrawal / sentimental analysis (twitter)
Created September 29, 2018 05:25
Sentimental analysis twitter
import re
import tweepy
from tweepy import OAuthHandler
from textblob import TextBlob
 
@Omkaragrawal
Omkaragrawal / gist:455b67cc24fa76a91495b728b2df6fb5
Created May 25, 2018 11:08 — forked from jaredhanson/gist:3989193
Node Knockout 2012 - Getting Started with Passport
var express = require('express'),
passport = require('passport'),
TwitterStrategy = require('passport-twitter').Strategy,
ensureLoggedIn = require('connect-ensure-login').ensureLoggedIn,
app = express();
app.use(express.static(__dirname + '/public'));
app.use(express.cookieParser());
app.use(express.session({ secret: 'keyboard cat' }));
app.use(passport.initialize());

Authentication with an Express API and Postgres

Setting Up

Let's make sure our Express app has the required base modules:

# within root of API
npm install --save express pg knex bcrypt
npm install --save-dev nodemon
@Omkaragrawal
Omkaragrawal / Hello world.py
Created May 21, 2017 22:49
first py program
print["Hello World this is my first line of code in Python."]