Skip to content

Instantly share code, notes, and snippets.

View shobhitg's full-sized avatar

Shobhit Gupta shobhitg

View GitHub Profile
@shobhitg
shobhitg / myturn.js
Last active March 12, 2021 08:57
MyTurn refresh script
var audioCtx = new (window.AudioContext ||
window.webkitAudioContext ||
window.audioContext)();
function beep(duration, frequency, volume, type, callback) {
var oscillator = audioCtx.createOscillator();
var gainNode = audioCtx.createGain();
oscillator.connect(gainNode);
gainNode.connect(audioCtx.destination);
@shobhitg
shobhitg / Buffer based fromStream
Last active July 7, 2019 05:10
RxJS fromStream Adapter
export default function fromStream<T = Uint8Array>(
stream: Readable,
finishEventName = "end",
dataEventName = "data"
) {
stream.pause();
const headerSize = 24;
const recordSize = 52;
let gotHeader: boolean = false;
let backStream: Buffer = Buffer.from([]);
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script src="https://unpkg.com/@reactivex/rxjs@5.0.3/dist/global/Rx.js"></script>
@shobhitg
shobhitg / .block
Last active April 27, 2017 23:56
fresh block
license: mit
@shobhitg
shobhitg / .block
Last active March 17, 2017 17:13
d3-bubble-mock
license: mit
@shobhitg
shobhitg / README.md
Created June 10, 2016 07:21
fresh block
@shobhitg
shobhitg / ES6_Singlet.js
Created April 24, 2016 20:13 — forked from milankarunarathne/ES6_Singlet.js
Create Singleton pattern using ES6
'use strict';
/**
* Created by Milan Karunarathne
* Email: mhkarunarathne@gmail.com
* May be freely distributed under the MIT license
*/
import EventEmitter from 'events';
class Single extends EventEmitter {
@shobhitg
shobhitg / README.md
Last active October 27, 2019 22:07
Migrants-Deaths-Visualization

Visulization of Migrant deaths in the Mediterranean

Used this very handy library called D3SvgOverlay which makes is very easy to overlay d3 components over leaflet maps.

Added some Crossfilter based timeline filtering via dc.js.

@shobhitg
shobhitg / server.js
Last active March 12, 2022 12:03
File upload example using busboy with express
var path = require('path');
var fs = require('fs');
var os = require('os');
var express = require('express');
var app = express();
var Busboy = require('busboy');
app.get('/', function (req, res) {
res.send('<html><head></head><body>\
<form method="POST" enctype="multipart/form-data">\
@shobhitg
shobhitg / a_song_of_ice_and_fire_chapter_graph.dot
Last active February 13, 2020 09:11
ASOIAF Chapterwise POV graph by /r/AbouBenAdhem
digraph "A Song of Ice and Fire" {
fontsize=32;
label="A Song of Ice and Fire\nChapter Graph";
labelloc=t;
ranksep=equally;
concentrate=true;
compound=true;
node [shape=record, color=blue, style=filled, fillcolor=lightsteelblue1]; AGOTKEY [label="A Game\nOf Thrones"];
AGOT0 [label="Prologue\n(Will)"]; AGOT1 [label="Bran I"];