Skip to content

Instantly share code, notes, and snippets.

View saurookadook's full-sized avatar

Andy Maskiell saurookadook

View GitHub Profile
@saurookadook
saurookadook / singleton.py
Created March 13, 2026 22:05 — forked from werediver/singleton.py
A thread safe implementation of singleton pattern in Python. Based on tornado.ioloop.IOLoop.instance() approach.
import threading
# Based on tornado.ioloop.IOLoop.instance() approach.
# See https://github.com/facebook/tornado
class SingletonMixin(object):
__singleton_lock = threading.Lock()
__singleton_instance = None
@classmethod
// Mini example of broading casting events with WebSockets in NestJS
import { Injectable } from '@nestjs/common';
import {
MessageBody,
SubscribeMessage,
WebSocketGateway,
WebSocketServer,
} from '@nestjs/websockets';
import { WebSocket, Server } from 'ws';
@saurookadook
saurookadook / README.md
Last active July 7, 2025 14:18 — forked from dsample/README.md
ASCII art diagrams

ASCI art characters for creating diagrams

also see Drawing ASCII Boxes

Characters

┐ └ ┴ ┬ ├ ─ ┼ ┘ ┌ │ ┤
╣ ║ ╗ ╝ ╚ ╔ ╩ ╦ ╠ ═ ╬
░ ▒ ▓ █ ▄ ▀ ■
function logAttrs({ displayName, obj }) {
console.group(displayName);
for (const [key, value] of Object.entries(obj)) {
console.log(`${key}: ${value}`);
}
console.groupEnd();
}
(function() {
@saurookadook
saurookadook / managing_multiple_ssh_identities.md
Last active March 14, 2025 19:53
Managing Multiple SSH Identities
{
"editor.semanticTokenColorCustomizations": {
"enabled": false,
// "rules": {
// "variable.defaultLibrary": "#E5C07B"
// },
"[One Dark Pro]": {
// Apply to this theme only
"enabled": true,
"rules": {
@saurookadook
saurookadook / .block
Created August 20, 2024 14:19 — forked from mbostock/.block
Wrapping Long Labels
license: gpl-3.0
@saurookadook
saurookadook / test.js
Last active February 16, 2024 18:47
[frontend migration blog post] NewClasslikeComponent example - test.js
import React from 'react';
import { cleanup, render } from '@testing-library/react';
import { rest } from 'msw';
import { setupServer } from 'msw/node';
import { NewClasslikeComponent, Provider } from 'example/components';
describe('NewClasslikeComponent component', () => {
const userHandle = "1959b2d6-e209-4a5e-a2ca-d4a0fb5cac68";
@saurookadook
saurookadook / styled.jsx
Created November 17, 2023 17:31
[frontend migration blog post] NewClasslikeComponent example - styled.jsx
import styled from 'styled-components';
import { JustShowTheStuff, ThingsToDoArea } from 'example/components';
const StretchyLikeSuspenders = styled.div`
align-items: flex-start;
display: flex;
flex-flow: row wrap;
justify-content: space-between;
`;
@saurookadook
saurookadook / index.no-styled.jsx
Created November 17, 2023 17:30
[frontend migration blog post] NewClasslikeComponent example - index.no-styled.jsx
import React, { useContext } from 'react';
import { JustShowTheStuff, ThingsToDoArea } from 'example/components';
import { collapseStuff, loadStuff } from 'example/store/stuff/actions';
import { collapseToDoItems, getThingsToDo } from 'example/store/thingsToDo/actions';
import { StateContext, DispatchContext } from 'example/context';
import styles from './style.css';
const NewClasslikeComponent = () => {
const { stuff, thingsToDo, user } = useContext(StateContext);