Skip to content

Instantly share code, notes, and snippets.

View zisra's full-sized avatar
🪨
Kicking rocks

zisra

🪨
Kicking rocks
View GitHub Profile
@zisra
zisra / networkTest.js
Last active August 21, 2022 19:55
Network test
const before = new Date();
fetch('https://httpbin.org/get').then(()=>{
const after = new Date();
console.log(`${after-before} Milliseconds`)
}).catch(()=>{
const after = new Date();
console.log(`Failed in ${after-before} Milliseconds`);
});
@zisra
zisra / addScripts.js
Created August 21, 2022 19:57
Add scripts
const addScripts = urls => {
let scriptsLoaded = 0;
return new Promise((resolve, reject) => {
urls.forEach((url) => {
const script = document.createElement('script');
script.src = url;
document.head.appendChild(script); // or document.body
script.onload = () => {
scriptsLoaded++;
if (scriptsLoaded === urls.length) {
@zisra
zisra / index.js
Last active March 21, 2023 23:40
Parse date
import parseDate from './parseDate.js';
parseDate('1 minute'); // => 60000
parseDate('1 hour'); // => 3600000
parseDate('Not a date'); // => Error: Invalid format
/*
* Usage: count {unit}
* Units:
* s, second, seconds, sec
@zisra
zisra / workbench.colorCustomizations.json
Created April 28, 2023 18:51 — forked from jacklorusso/workbench.colorCustomizations.json
A list of all Visual Studio Code customizable colors, grouped by UI region. Copy and paste into User Settings (comments are allowed) to tweak an existing theme or work on your own.
"workbench.colorCustomizations": {
// Contrast Colors - The contrast colors are typically only set for high contrast themes. If set, they add an additional border around items across the UI to increase the contrast.
"contrastActiveBorder": "",
"contrastBorder": "",
// Base Colors
"focusBorder": "",
"foreground": "",
"widget.shadow": "",
"selection.background": "",
"descriptionForeground": "",
@zisra
zisra / elementRegex.md
Last active June 5, 2023 14:44
A regex that removes a specific HTML element from a string

]*>([\s\S]*?)<\/element-name>

@zisra
zisra / weather.ino
Last active August 11, 2023 14:39
Weather arduino
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <WiFiClientSecure.h>
#include <Arduino_JSON.h>
#include <LedControl.h>
#include <NTPClient.h>
#include <WiFiUdp.h>
int latitude = 48.83;
int longitude = 10.09;
@zisra
zisra / googleClassroom.js
Created September 9, 2023 11:39
Remove Google Classroom classes
window.onload = () => {
const blackList = [
"Math",
"Science",
];
const observer = new MutationObserver((mutationsList) => {
for (const mutation of mutationsList) {
if (mutation.type === "childList" && mutation.addedNodes.length > 0) {
const matchingElements = Array.from(
const lessonUUID = window.location.pathname.split("/")[2];
const sleep = (m) => new Promise((r) => setTimeout(r, m));
fetch(
`https://api.garbanzo.io/api/assignment/${lessonUUID}?localized_date_time=2023-09-14%2011:31:06`,
{
headers: {
authorization: localStorage.getItem("auth._token.local"),
},
method: "GET",
@zisra
zisra / eloCalculator.ts
Last active October 23, 2023 01:19
Calculate ELO
const K_FACTOR = 20;
const RATING_SCALING = 400;
interface Player {
isWin: boolean;
elo: number;
}
interface Result {
firstPlayer: Player;
echo -e "
127.0.0.1 marriott.com
" | sudo tee -a /etc/hosts >/dev/null