Skip to content

Instantly share code, notes, and snippets.

View Shimilbi's full-sized avatar
💭
I may be slow to respond.

Shimilbi, tiny freelancer Shimilbi

💭
I may be slow to respond.
View GitHub Profile
@Shimilbi
Shimilbi / GlobalFunctionExtensions_AndOthers.ts
Last active January 18, 2024 14:55
Open raw, and search for keywords.
import { exec } from "child_process"
//#region //////////////////////////////////////////////////////
//#region Exdending API objects with new functions inJS (different from Class oriented Language like C# and Java)
//#region In order to be able to call them as: type.function() instead of function(type)
// Only do this in small-team projects not to crowd the prototype node too much!
//#region //////////////////////////////////////////////////////
// Extension functions (easier to do with Typescript thanks to the declare and interface statments)
// Note: "global" interfaces and functions are automatically exported, no need to add "export"
declare global {
@Shimilbi
Shimilbi / center.css
Created January 17, 2024 13:41
CSS Vertical-Align once and for all
/*
* Example of use:
<some_dom_element center>
Or:
<some_dom_element valign>
*/
*[center]{position:absolute;left:50%;top:50%;transform:translateX(-50%) translateY(-50%);}
*[valign]{position:absolute;top:50%;transform:translateY(-50%);}
@Shimilbi
Shimilbi / readme.md
Last active January 17, 2024 11:34
Netflix- MyList > Export To File

Export Netflix MyList

inspired by: MichaelCurrin/export-netlix-list.md

Action: Exports names of shows on your Netflix profile list. Remember that the list mixes both your watchlist and your favorites. You might want to filter it later.

Prerequisites

  • A Netflix account that you are signed into
  • Movies or shows added to Your List
@Shimilbi
Shimilbi / discord-webhook.js
Created January 14, 2024 14:48 — forked from dragonwocky/discord-webhook.js
js post request example for discord webhooks using the fetch web api
// node.js versions pre-v0.18.0 do not support the fetch api and require a polyfill
// const fetch = require('node-fetch');
fetch(
'https://discordapp.com/api/webhooks/738983040323289120/mzhXrZz0hqOuUaPUjB_RBTE8XJUFLe8fe9mgeJjQCaxjHX14c3SW3ZR199_CDEI-xT56',
{
method: 'post',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
@Shimilbi
Shimilbi / ArrayRandomizer.ts
Created January 13, 2024 05:50
Randomizer with options that picks an entry from an array
export class Randomizer<T> {
Pool :T[]
UsedEntries? :T[]
LastPick? :T
DebugErrorTolerence :number = 5
constructor(...list:T[]) {
this.Pool = list as T[]
@Shimilbi
Shimilbi / CustomPromise.ts
Last active January 17, 2024 13:43
Custom promise to detect a click on discord button and return the button clicked (modified, modifications not tested). Follows TypeScript notations...
/**
*Parameters
promisedData must be declared in another part of the code prior to the call of this function.
dom_selector is only and example of use. this can perfectly be used backend for servers and output in a server-side file, another gui, a distant ftp, etc,
*Returns the promised data (here, wyth typescript, it is a string).
Is resolved when the given parameter promisedData is no longer undefined.
*Example of call:
let myPromiseOfData
// ...
myPromiseOfData = "MY HEART IS TRUE"
function toggleDetails (element, setOpen) {
const attr = document.createAttribute('open')
if (setOpen===undefined) {
if (element.hasAttribute('open'))
element.removeAttribute('open')
else {
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>File to text data (blob)</title>
</head>
<body center style="text-align:left;">
<h2>File to text data <code>(blob)</code></h2>
var ascending = true
var lastFieldName = ''
function SortBy(arr, fieldName) {
if (ascending) {
arr.sort((p1, p2) => {
if (p1[fieldName] < p2[fieldName]) return -1
if (p1[fieldName] > p2[fieldName]) return 1
return 0
})