Skip to content

Instantly share code, notes, and snippets.

View o0101's full-sized avatar
🏖️
Netscaping

Cris o0101

🏖️
Netscaping
View GitHub Profile
@o0101
o0101 / the roots of complacency.md
Created October 15, 2024 15:57
The Roots of Complacency by Dr. J. Allen Hynek

source: Dr. Willy Smith Unicat Project June 1999, https://rense.com/ufo5/hudsonv.htm

The Roots of Complacency by Dr. J. Allen Hynek

Something truly astonishing happened.... Not far from New York City, along the Hudson Valley, as hundreds of astonished people looked up, many driving along the Taconic Parkway, they saw something no one had ever seen before. Some called it a "Space-ship from outer space" (for want of anything better) but it was generally described by numbers of competent, professional persons as startlingly brilliant lights, in the form of a "V", or Boomerang, silent, slowly-moving, and very large close-by object. It has often popularly been called the "Westchester (County) Boomerang".

The world has never known about this, even though the event happened not once but several times, and over the course of several years. To all intents and purposes, this was a non-event. The media across the world has remained dumb. Local papers, radios and TV's, it is true, did momentarily carry spots along

@o0101
o0101 / README.md
Last active November 10, 2023 09:37
Implementing Protected Members in JavaScript by Hacking Symbols and Private Fields

Implementing Protected Members in JavaScript Classes

Introduction

In many object-oriented languages, the concept of protected members allows properties and methods to be accessible within the class they are defined, as well as by subclasses. JavaScript, however, does not natively support protected members. This article introduces a novel approach to simulate protected access in JavaScript classes using symbols and private fields.

The Challenge

JavaScript provides private fields, but they are not accessible to any derived classes. This limitation means that developers cannot use private fields to directly implement protected members, which are a staple in many other object-oriented languages.

One Solution

The solution involves using symbols as keys for protected properties and methods, ensuring that only the class and its subclasses have access to them. This is achieved by:

@o0101
o0101 / base.js
Last active November 10, 2023 09:37
Simple Custom Element Base Class With Neat Implicit Templating
{
const $ = Symbol(`[[state]]`);
class Base extends HTMLElement {
static get observedAttributes() {
return ['state'];
}
constructor(state) {
super(state);
@o0101
o0101 / !WITH_LOCK.md
Last active November 10, 2023 09:37
with_lock: A simple Bash decorator function for concurrency control

with_lock

Simplify Bash Locking: Your Decorator for Safe Scripting

Hey, scripter! Need to make your Bash functions play nice in the concurrency sandbox? You're in luck!

with_lock is your go-to decorator. It ensures specified functions run one at a time, even across multiple script instances. 🤖

Caveats

  • It's mostly FIFO (first in, first out), but occasionally things get a bit mixed. 🤷‍♀️
@camthesaxman
camthesaxman / win98.html
Last active June 16, 2023 15:45
Windows 98 Simulator
<html>
<head>
<title>Windows 98</title>
<meta charset="UTF-8">
<link rel="stylesheet" href="https://unpkg.com/98.css">
<style>
/* Disable image filtering */
img {
image-rendering: optimizeSpeed; /* STOP SMOOTHING, GIVE ME SPEED */
@stefanocudini
stefanocudini / web_htop.sh
Last active January 3, 2023 04:23
web colored interface for htop
#!/bin/bash
# requirements: apt install nmap htop aha
# (aha is ANSI color to HTML converter)
ncat -k -l -p 9999 -c "echo 'HTTP/1.1 200 OK\nContent-type: text/html\nconnection: close\\n'; echo q | htop | aha --black --line-fix"
@ilokhov
ilokhov / export-sync-bookmarks.js
Last active September 30, 2024 11:44
Node.js script for exporting and synchronising bookmarks from Google Chrome
const fs = require("fs");
const path = require("path");
function newItem(name, url) {
return { name, url };
}
const bookmarkPath = path.join(
process.env.HOME,
"/Library/Application Support/Google/Chrome/Default/Bookmarks"
@o0101
o0101 / wow.js
Created September 28, 2017 09:45
Micro Spread Sheet
// check this: http://jsfiddle.net/ondras/hYfN3/
@o0101
o0101 / neucomponents.js
Last active September 24, 2017 04:25
It all sucks. Time to make it better.
/**
So dosyhil gives good components on the server.
What about the client?
**/
// example
const components = {};
Object.assign( self, { components } );
def`
@o0101
o0101 / index.html
Created September 23, 2017 18:15 — forked from anonymous/index.html
Bookmarklet // source https://jsbin.com/nosefuduju
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Bookmarklet</title>
</head>
<body style="max-width:700px; margin:0 auto;">
<p>Here is the bookmarklet:
<a href="javascript:(function()%7B(function()%20%7Bconst%20req%20%3D%20new%20XMLHttpRequest()%3Bconst%20key%20%3D%20'AIzaSyAUYMRSUW3BAZLhSTbB1poQuQ4xaqt2C4c'%3Breq.open('POST'%2C%20'https%3A%2F%2Fwww.googleapis.com%2Furlshortener%2Fv1%2Furl%3Fkey%3D'%2Bkey)%3Breq.setRequestHeader(%22Content-Type%22%2C%20%22application%2Fjson%22)%3Breq.responseType%3D%22json%22%3Breq.send(JSON.stringify(%7BlongUrl%3Alocation.href%7D))%3Bconst%20text%20%3D%20document.createElement('textarea')%3Blet%20result%3BsetTimeout(%20()%20%3D%3E%20(document.execCommand('copy')%2Ctext.remove())%2C%20700%20)%3Breq.onreadystatechange%20%3D%20()%20%3D%3E%20%7Bif%20(%20req.status%20%3D%3D%20200%20%26%26%20req.readyState%20%3D%3D%204%20)%20%7Bdocument.body.appendChild(text)%3Btext.value%20%3D%20req.response.id%3Btext.se