Skip to content

Instantly share code, notes, and snippets.

View eyedean's full-sized avatar
🙃
Getting There!

Aideen NasiriShargh eyedean

🙃
Getting There!
View GitHub Profile
<script type="text/javascript">
[...document.getElementsByClassName("mejs__controls"),...document.getElementsByClassName("mejs__layers")].forEach((x)=>{ if(!x.parentElement.parentElement.parentElement.parentElement.classList.contains("mejs__mediaelement")) x.style.display="none" });
c={}; [...document.getElementsByTagName("svg")].forEach((x) => c[x.classList[0]] = c[x.classList[0]] || x.querySelector(":not(use"));
[...document.getElementsByTagName("svg")].forEach((x) => { if (!x.querySelector(":not(use)")) { y = c[x.classList[0]]; y.childNodes.forEach(z=>x.appendChild(z.cloneNode(true))); }})
</script>
@eyedean
eyedean / gen_IANA_time_zone_names_json.js
Last active November 14, 2021 20:16
Generate IANA Time Zone Names, in a JSON array, from timezones.json package
// Creating a JSON file, containing IANA Time Zone Names from timezones.json package.
// See this stackoverflow question: https://stackoverflow.com/a/69966796/
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Short version:
// const namesSet = new Set();
// require("timezones.json").forEach((tzDefinition) => tzDefinition.utc.forEach((tzName) => namesSet.add(tzName)));
// console.log(JSON.stringify([...namesSet].sort()));
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@eyedean
eyedean / vue-router-augmented-push.ts
Last active September 13, 2023 10:01
Augment Router.push of Vue-Router to suppress the "Uncaught (in promise) Error: Redirected when going from..." errors.
// Based on the following solution
// https://github.com/vuejs/vue-router/issues/2881#issuecomment-520554378
// Read my detailed notes at: https://stackoverflow.com/a/65326844
import Router, { RawLocation, Route } from "vue-router";
// Personal utils. Can be replaced with `Function` and `(e: Error) => any;` respectively.
export type AnyFunction<RETURN_T = any> = (...args: any[]) => RETURN_T;
export type ErrorHandlerFunction<RETURN_T = any> = (e: Error) => RETURN_T;
@eyedean
eyedean / all_subsets.c
Created October 15, 2013 20:15
Write out all subsets of a given set.
#include <stdio.h>
#include <string.h>
int main()
{
int a[] = {1, 2, 3};
int n = sizeof(a) / sizeof (a[0]);
int i, j;
for (i=0; i<(1<<n); i++) {
for (j=0; j<n; j++)