Skip to content

Instantly share code, notes, and snippets.

@anuragvohraec
anuragvohraec / read.md
Created April 1, 2024 11:21
Enable WebGPU on Chrome on linux
  1. Open chrome://flags/ in chrome
  2. Enable all this options image
{
Dynamic Linker Bug
Memcheck:Cond
fun:_dl_relocate_object
fun:dl_main
fun:_dl_sysdep_start
fun:_dl_start
obj:/lib/ld-2.6.so
}
{
@anuragvohraec
anuragvohraec / pearson-hashing.js
Created July 15, 2021 14:32 — forked from thejsj/pearson-hashing.js
Pearson Hashing Function
'use strict'
// Ideally, this table would be shuffled...
// 256 will be the highest value provided by this hashing function
let table = [...new Array(256)].map((_, i) => i)
const hash8 = (message, table) => {
return message.split('').reduce((hash, c) => {
return table[(hash + c.charCodeAt(0)) % (table.length - 1)]
}, message.length % (table.length - 1))
@anuragvohraec
anuragvohraec / create-a-file-and-upload-as-attachment-to-couchdb.js
Created January 4, 2021 03:34 — forked from rjcorwin/create-a-file-and-upload-as-attachment-to-couchdb.js
With Javascript, create a new file and send it to a CouchDB database as an attachment to a document
// With Javascript, create a new file and send it to a CouchDB database as an attachment of a Document
// Code inspired by "NEW TRICKS IN XMLHTTPREQUEST2" by Eric Bidelman
// http://www.html5rocks.com/en/tutorials/file/xhr2/
/*
* There are two ways of accomplishing this. The first way will always result in a filename of "blob", which is
* bummer. The second way you will be able to name the file what you want. Note that these examples
* assume you have the ID of the database, the ID of the Document, and the most recent revision hash of that Document.
*/
@anuragvohraec
anuragvohraec / .Service Worker Setup.md
Created December 11, 2020 22:28 — forked from bryandh/.Service Worker Setup.md
Service Worker setup in Typescript

Service Worker Setup

@anuragvohraec
anuragvohraec / WebViewServer.kt
Created October 2, 2020 02:35 — forked from ErikHellman/WebViewServer.kt
This class is no longer needed now that Google provides WebViewAssetLoader (see https://developer.android.com/reference/kotlin/androidx/webkit/WebViewAssetLoader)
/*
MIT License
Copyright (c) 2019 Erik Hellman
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@anuragvohraec
anuragvohraec / CountryCodes.json
Created April 10, 2020 07:56 — forked from Goles/CountryCodes.json
Country and Dial or Phone codes in JSON format
[{"name":"Israel","dial_code":"+972","code":"IL"},{"name":"Afghanistan","dial_code":"+93","code":"AF"},{"name":"Albania","dial_code":"+355","code":"AL"},{"name":"Algeria","dial_code":"+213","code":"DZ"},{"name":"AmericanSamoa","dial_code":"+1 684","code":"AS"},{"name":"Andorra","dial_code":"+376","code":"AD"},{"name":"Angola","dial_code":"+244","code":"AO"},{"name":"Anguilla","dial_code":"+1 264","code":"AI"},{"name":"Antigua and Barbuda","dial_code":"+1268","code":"AG"},{"name":"Argentina","dial_code":"+54","code":"AR"},{"name":"Armenia","dial_code":"+374","code":"AM"},{"name":"Aruba","dial_code":"+297","code":"AW"},{"name":"Australia","dial_code":"+61","code":"AU"},{"name":"Austria","dial_code":"+43","code":"AT"},{"name":"Azerbaijan","dial_code":"+994","code":"AZ"},{"name":"Bahamas","dial_code":"+1 242","code":"BS"},{"name":"Bahrain","dial_code":"+973","code":"BH"},{"name":"Bangladesh","dial_code":"+880","code":"BD"},{"name":"Barbados","dial_code":"+1 246","code":"BB"},{"name":"Belarus","dial_code":"+375","
@anuragvohraec
anuragvohraec / launch.json
Created April 9, 2020 11:41 — forked from cecilemuller/launch.json
Run ts-node in VSCode Debugger
{
"version": "0.2.0",
"configurations": [
{
"name": "Node Inspector",
"type": "node",
"request": "launch",
"args": ["${workspaceRoot}/src/service.ts"],
"runtimeArgs": ["-r", "ts-node/register"],
"cwd": "${workspaceRoot}",
@anuragvohraec
anuragvohraec / settings.json
Created April 8, 2020 02:31
VSCODE workspace
{
"files.watcherExclude": {
"**/.git/objects/**": true,
"**/.git/subtree-cache/**": true,
"**/node_modules/*/**": true
},
"todo-tree.general.tags": [
"BUG",
"HACK",
@anuragvohraec
anuragvohraec / typescript-web-components.md
Created April 3, 2020 11:22 — forked from aelbore/typescript-web-components.md
Step by Step creating web components in typescript using rollup

Getting Started

  • Install Dependencies
    npm init
    npm install --save-dev ts-node typescript tslib express @types/express
    

Create your web server

  • Create server.ts in root folder of your app.