Skip to content

Instantly share code, notes, and snippets.

@abhishekmunie
abhishekmunie / walk.ts
Last active March 15, 2020 18:15
TypeScript: for async of directory walk
import { promises as fs } from 'fs';
import { resolve as resolvePath } from 'path';
/**
* Recursively walk a directory asynchronously and yeild file names (with full path).
*
* @param path Directory path you want to recursively process
* @param filter Optional filter to specify which files to include
*/
async function* walk(path: string, filter?: (file: string) => boolean) {
@abhishekmunie
abhishekmunie / TwinklingCanvas.html
Created October 27, 2013 10:14
Twinkling Canvas using Web Worker
<!DOCTYPE html>
<html class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Twinkling Canvas</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="main.css">
<script src="modernizr-2.6.2.min.js"></script>
@abhishekmunie
abhishekmunie / main.c
Created February 24, 2013 20:45
CPU Scheduling Gantt Chart generator.
#include <stdio.h>
#include <limits.h>
#include <stdbool.h>
typedef struct Job {
unsigned int id;
unsigned int arrivalTime;
unsigned int priority;
unsigned int burstTime;
unsigned int remainingTime;
@abhishekmunie
abhishekmunie / main.cpp
Created November 9, 2012 04:54
Finding minimum cost to visit all vertices in a graph and returning back.
//
// main.cpp
// FloydGreedyTravel
//
// The program tries to find a path to visit all vertices of Graph.
// The rules are:
// * Nodes can be visited more than once.
// * Try to find shortest path
//
// First it find All-Pairs Shortest Paths using The Floyd-Warshall algorithm.
@abhishekmunie
abhishekmunie / checkString.js
Created April 3, 2012 17:21
Check if a string is equivalent to number or boolean, and convert it.
function checkString(str){
try{str=JSON.parse(str);}catch(e){}
return str;
}
@abhishekmunie
abhishekmunie / index.html
Created January 14, 2012 08:09
Animated Sky Background - sky animated by changing background position of 3 div element using CSS3 animations
<!doctype html>
<html class="animations-on">
<link href="main000.css" rel="stylesheet" type="text/css"/>
<div id="sky_background" class="sky_back"></div><div id="sky_midground" class="sky_back"></div><div id="sky_foreground" class="sky_back"></div>
</html>