Skip to content

Instantly share code, notes, and snippets.

View sayjeyhi's full-sized avatar
:electron:
Building things

Jafar Rezaei sayjeyhi

:electron:
Building things
View GitHub Profile
<script src="https://cdn.jsdelivr.net/npm/animejs@3.2.1/lib/anime.min.js"></script>
<script>
// Fireworks
window.addEventListener('load', () => {
const canvasEl = document.createElement("canvas");
canvasEl.classList.add("fireworks");
document.body.append(canvasEl);
const ctx = canvasEl.getContext("2d");
@sayjeyhi
sayjeyhi / WAV.ts
Created November 30, 2021 21:37
Create a wav, from raw data
'use strict';
export default class WAV {
private readonly header: ArrayBuffer;
private readonly data: Uint8Array;
private view: DataView;
private pointer: number;
private littleEndian: boolean | undefined;
static semitone(note = 'REST') {
export const concatArrayBuffers = (buffer1: ArrayBuffer, buffer2: Buffer) => {
const tmp = new Uint8Array(buffer1.byteLength + buffer2.byteLength);
tmp.set(new Uint8Array(buffer1), 0);
tmp.set(new Uint8Array(buffer2), buffer1.byteLength);
return tmp.buffer;
};
@sayjeyhi
sayjeyhi / k8s.statuses.txt
Created September 29, 2021 20:01
kubernetes statue list for nodes, pods and replicationControllers
kubernetes:
node:
- TerminatedAllPods # Terminated All Pods (information)
- RegisteredNode # Node Registered (information)*
- RemovingNode # Removing Node (information)*
- DeletingNode # Deleting Node (information)*
- DeletingAllPods # Deleting All Pods (information)
- TerminatingEvictedPod # Terminating Evicted Pod (information)*
- NodeReady # Node Ready (information)*
- NodeNotReady # Node not Ready (information)*
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
materialColor: function () {
// colors from https://github.com/egoist/color-lib/blob/master/color.json
var colors = {
"red": {
/* "50": "#ffebee", */
/* "100": "#ffcdd2", */
/* "200": "#ef9a9a",*/
/* "300": "#e57373",*/
"400": "#ef5350",
"500": "#f44336",
Vue.js 1 hr 46 mins ██████████▓░░░░░░░░░ 38.5%
JavaScript 1 hr ███████▒░░░░░░░░░░░░ 21.8%
HTML 44 mins ██████░░░░░░░░░░░░░░ 16.0%
JSON 35 mins █████▒░░░░░░░░░░░░░░ 12.7%
function convertTypeToAction(types) {
function toCamelCase(str) {
// Lower cases the string
return str.toLowerCase()
.replace( /[-_]+/g, ' ')
.replace( /[^\w\s]/g, '')
.replace( / (.)/g, function($1) { return $1.toUpperCase(); })
.replace( / /g, '' );
}
M 14.33,20
h -0.21
a 2,2 0 0 1 -1.76,-1.58
L 9.68,6
l -2.76,6.4
A 1,1 0 0 1 6,13
H 3
a 1,1 0 0 1 0,-2
h 2.34
l 2.51,-5.79
// get table of contents and apply answer link on them
html = html.replace(
/<td><a \S+=["']?#((?:.(?!["']?\s+(?:\S+)=|\s*\/?[>"']))+.)["']?.*>(.*)<\/a><\/td>/gm,
(whole, p1, p2) =>
`<td id="${makeUrl(p2)}-q"><a class="fehrest" href="#${makeUrl(
p2
)}">${p2}</a></td>`
);