Skip to content

Instantly share code, notes, and snippets.

View techsin's full-sized avatar
🏠
Working from home

techsin techsin

🏠
Working from home
  • New York, NY
View GitHub Profile
@techsin
techsin / download_audio.js
Created August 13, 2020 17:53
download audio recording in sms google voice
document.querySelectorAll('audio').forEach((au) => {
const url = au.currentSrc;
fetch(url).then(r => r.blob()).then(obj => downloadAudio(obj));
})
function downloadAudio(blob) {
const ele = document.createElement('a');
let counter = 0;
downloadAudio = function (blob) {
@techsin
techsin / islands.js
Created June 12, 2020 04:40
find islands leetcode
var numIslands = function(grid) {
let islands = 0;
for (let i = 0; i < grid.length; i++) {
for (let j = 0; j < grid[i].length; j++) {
if (grid[i][j] == 1) {
markRecur(i, j, grid);
islands++;
}
}
}
@techsin
techsin / title1.js
Created May 29, 2020 16:28
animation on title
var str = '-¯-_';
var i;
var j = 0;
document.title = '‎';
setInterval(function(){
document.title = document.title + str[j++];
j = j % str.length;
i = i || 0;
i = ++i % (str.length * 5);
if (!i) document.title = '‎';
/* Setup */
class Node {
left = null;
right = null;
constructor(val) {
this.val = val;
}
}
const A = new Node('A');
@techsin
techsin / solution.js
Last active April 17, 2020 23:45
lru cache
var LRUCache = function(capacity) {
this.hash = {};
this.capacity = capacity;
this.counter = 0;
};
LRUCache.prototype.get = function(key) {
const obj = this.hash[key];
if (typeof obj === "undefined") {
@techsin
techsin / postgres-brew.md
Created January 9, 2020 21:15 — forked from ibraheem4/postgres-brew.md
Installing Postgres via Brew (OSX)

Installing Postgres via Brew

Pre-Reqs

Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update
@techsin
techsin / temp.js
Last active November 5, 2019 05:06
tempreature tracker
class TemperatureTracker {
constructor() {
this.records = [];
this.minV = null;
this.maxV = null;
this.freq = {};
this.sum = 0;
this.n = 0;
this.modeMax = null;
this.modeV = null;
@techsin
techsin / file.js
Created July 1, 2019 15:32
Reaction time sens clicker
var ele = document.querySelector('.test-standard.reaction-time-test');
var config = { attributes: true };
var event = new MouseEvent('mousedown', {
bubbles: true,
cancelable: true
});
var callback = function (mutationsList, observer) {
for (var mutation of mutationsList) {
@techsin
techsin / scrape_commerce.js
Created April 7, 2019 19:17
scrape_companies_commerce_nyc
class Company {
static fetchStack = [];
static data = [];
static fetched = 0;
static interval = 300;
static intervalVariance = 100;
constructor(tr) {
Company.fetchStack.push(tr);
}
@techsin
techsin / script.js
Created April 2, 2019 16:57
Scraping Angellist to csv
class Company {
name;
desc;
joined;
location;
market;
website;
employees;
stage;
constructor(...rest) {