Skip to content

Instantly share code, notes, and snippets.

@sabha
sabha / Tezos
Created January 24, 2022 19:49
I am attesting that this GitHub handle sabha is linked to the Tezos account tz1PSXjV2KVtZzxxVqQdCtJhWUAE4rFy3gyN for tzprofiles sig:edsigtvdmXjuwev2zbQhXpQZciJyVpXidWUtmrDGJDXj24NeAMxzj82TPtHmyQBpWHacj5wWhthjrSNYtScAYbURxKJQHxspisF
I am attesting that this GitHub handle sabha is linked to the Tezos account tz1PSXjV2KVtZzxxVqQdCtJhWUAE4rFy3gyN for tzprofiles
sig:edsigtvdmXjuwev2zbQhXpQZciJyVpXidWUtmrDGJDXj24NeAMxzj82TPtHmyQBpWHacj5wWhthjrSNYtScAYbURxKJQHxspisF
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Triangle</title>
<style>
canvas {
border: solid 1px;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Square</title>
<style>
canvas {
border: solid 1px;
}
@sabha
sabha / delete.js
Last active June 23, 2019 18:14
ServerLess using Lambda - DynamoDB
'use strict'
const AWS = require('aws-sdk');
exports.handler = async (event, context) => {
const documentClient = new AWS.DynamoDB.DocumentClient();
let responseBody = "";
let statusCode = 0;
const { id } = event.pathParameters;
@sabha
sabha / index.html
Created April 28, 2019 17:34
Circle Interaction Pattern
<!DOCTYPE html>
<html>
<body>
<canvas id="myCanvas" width="800" height="500" style="border:1px solid #d3d3d3;">
Your browser does not support the HTML5 canvas tag.</canvas>
<script>
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
@sabha
sabha / index.html
Last active February 21, 2019 05:42
Conflict
<!DOCTYPE html>
<html>
<head>
<style>
body{
background-color: black;
}
</style>
@sabha
sabha / frequency.js
Created November 28, 2018 17:02
Stats Frequency
//var data = ['A', 'O', 'A', 'B', 'B', 'AB', 'B', 'B', 'O', 'A', 'O', 'O', 'O', 'AB', 'B', 'AB', 'AB', 'A', 'O', 'A'];
var data = ['A', 'O', 'A','A','A','A', 'A','A','A','A', 'A','A','A','A', 'A','A','A','A', 'A','A','A','A'];
var count = {}
data.forEach((d) => {
count[d] = ((count[d] === undefined) ? 1 : (count[d]+1));
});
var addAll = (accumulator, currentValue) => accumulator + currentValue;
var len = Object.keys(count).map((r) => count[r]).reduce(addAll);
Object.keys(count).map((r) => {
console.log((count[r]/len)*100);
@sabha
sabha / index.html
Created July 17, 2018 21:35
Binary Tree
<!DOCTYPE html>
<html>
<body>
<canvas id="myCanvas" width="600" height="600" style="border:1px solid #d3d3d3;">
Your browser does not support the HTML5 canvas tag.</canvas>
<script>
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
@sabha
sabha / index.html
Last active June 25, 2018 14:58
Random Rect
<!DOCTYPE html>
<html>
<body>
<canvas id="myCanvas" width="640" height="480" style="border:1px solid #d3d3d3;">
Your browser does not support the HTML5 canvas tag.</canvas>
<script>
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
@sabha
sabha / index.html
Created April 27, 2018 20:16
Dynamic
<!DOCTYPE html>
<html>
<body>
<canvas id="myCanvas" width="600" height="600" style="border:1px solid #d3d3d3;">
Your browser does not support the HTML5 canvas tag.</canvas>
<script>
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");