Skip to content

Instantly share code, notes, and snippets.

View DipanshKhandelwal's full-sized avatar

Dipansh Khandelwal DipanshKhandelwal

View GitHub Profile
@DipanshKhandelwal
DipanshKhandelwal / Object Oriented Programming with Dart.dart
Last active April 5, 2018 08:41
Object Oriented Programming with Dart
//Created by Dipansh Khandelwal
// Github @DipanshKhandelwal
import 'dart:math';
abstract class Shape {
List<double> sides;
double perimeter;
Shape(this.sides) {
@DipanshKhandelwal
DipanshKhandelwal / jacobi_method.py
Created November 21, 2018 05:40
Iterative Solution : Jacobi method
import numpy as np
# Iterative solution
# Jacobi method
def jacobi(A, b, x0, k):
# A = D + L + U
# D is matrix with diagonal elements
# L is lower triangular matrix
# U is upper triangular matrix
#
@DipanshKhandelwal
DipanshKhandelwal / ConnectFour_Win_Logic.js
Created April 6, 2019 02:35
An efficient win check for connect four game !!
checkWinner = ({ column, row, board }) => {
// ROW CHECK
for (var i = 0; i < 4; i++) {
if (column - 3 + i >= 0 && column + i < 7) {
if (this.checkLine(
board[column - 3 + i][row],
board[column - 2 + i][row],
board[column - 1 + i][row],
board[column - 0 + i][row],
)) {
@DipanshKhandelwal
DipanshKhandelwal / MongoQueries.md
Last active July 8, 2019 07:59
Data mongo queries

Mongo Queries

[x] a. How many smart contacts does my user have?

[x] b. How many people do they speak to on average?

[x] c. What is the percentage of outgoing calls they make?

[x] d. How much time do they spend on phone calls?

@DipanshKhandelwal
DipanshKhandelwal / index.html
Created March 12, 2020 06:46
Simple HTML5 Socket
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset=utf-8>
<title>HTML5 Socket</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.3.0/socket.io.js"></script>
<script>
const socket = io.connect('ws://localhost:8080', { transports: ['websocket'] });
console.log(socket);
socket.on('connect', () => {
@DipanshKhandelwal
DipanshKhandelwal / twitter_verified_usernames.py
Created August 19, 2020 10:50
Scraping Verified Twitter Usernames
import oauth2 as oauth
import json
import random
import time
# You can add as many keys as you want here !! :)
keys = {
"key1": {
"CONSUMER_KEY": "",
"CONSUMER_SECRET": "",
@DipanshKhandelwal
DipanshKhandelwal / twitter_verified_usernames_selenium.py
Created August 19, 2020 16:03
Scraping Verified Twitter Usernames using Selenium
import time
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_argument("--headless")
driver = webdriver.Chrome('/usr/lib/chromium-browser/chromedriver', chrome_options=chrome_options)
driver.get('https://www.twitter.com/login')
import React, { useState } from 'react';
import { Text, StyleSheet, Button, View, TextInput } from 'react-native';
export default function RoomScreen({ setScreen, screens, setRoomId, roomId }) {
const onCallOrJoin = (screen) => {
if (roomId.length > 0) {
setScreen(screen)
}
}
import React, { useState } from 'react';
import { Text, StyleSheet, SafeAreaView, RecyclerViewBackedScrollView } from 'react-native';
import RoomScreen from './screens/RoomScreen';
import CallScreen from './screens/CallScreen';
import JoinScreen from './screens/JoinScreen';
// Just to handle navigation
export default function App() {
const screens = {
ROOM: 'JOIN_ROOM',