Skip to content

Instantly share code, notes, and snippets.

@AnthoniG
AnthoniG / browser-colors.ts
Created July 21, 2022 07:47
browser-colors
{
"aliceblue",
"antiquewhite",
"aqua",
"aquamarine",
"azure",
"beige",
"bisque",
"black",
"blanchedalmond",
@AnthoniG
AnthoniG / gtk4_template.py
Created July 19, 2022 04:57
python GTK4 app template
# Load Gtk
import gi
gi.require_version('Gtk', '4.0')
from gi.repository import Gtk
# When the application is launched…
def on_activate(app):
# … create a new window…
win = Gtk.ApplicationWindow(application=app)
# … with a button in it…
#!/usr/bin/env python3
# Python imports
import sys
# GTK imports
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gio
from gi.repository import Gtk
@AnthoniG
AnthoniG / app.py
Created July 18, 2022 14:26 — forked from carlos-jenkins/app.py
How to programatically add new menu items to menu item in PyGObject.
"""
Hierarchy is:
- GtkMenuBar
- GtkMenuItem
- GtkMenu
- GtkMenuItem
- GtkImageMenuItem
- GtkCheckMenuItem
- GtkRadioMenuItem
- GtkSeparatorMenuItem
@AnthoniG
AnthoniG / example.py
Created July 16, 2022 23:52
Python – CellRendererText in GTK+ 3
from gi.repository import Gtk
import gi
gi.require_version("Gtk", "3.0")
class CellRendererTextWindow(Gtk.Window):
def __init__(self):
Gtk.Window.__init__(self, title ="Geeks For Geeks")
@AnthoniG
AnthoniG / mern-server-setup.md
Last active June 20, 2022 19:00 — forked from bradtraversy/mern-server-setup.md
Setup Ubuntu & Deploy MERN app

Brad's Youtube Duide

Linux Server Setup & MERN App Deployment

These are the steps to setup an Ubuntu server from scratch and deploy a MERN app with the PM2 process manager and Nginx. We are using Linode, but you could just as well use a different cloud provider or your own machine or VM.

Create an account at Linode

Click on Create Linode

Choose your server options (OS, region, etc)

@AnthoniG
AnthoniG / useLoaderStore.ts
Created June 7, 2022 00:05 — forked from andrelandgraf/useLoaderStore.ts
Wrapper hook for useMatches to quickly access loader data across components in Remix.run
import { useMatches } from 'remix';
// this base hook is used in other hooks to quickly search for specific data across all loaderData using useMatches
// see in action: https://codesandbox.io/s/usematches-loader-data-2h798?file=/app/db.server.ts
export default function useLoaderStore<T>(key: string): T | undefined {
const matchingRoutes = useMatches();
const route = matchingRoutes.find((route) => route.data && route.data[key]);
if (!route || !route.data || route.data[key] === undefined) {
return undefined;
}
@AnthoniG
AnthoniG / image.ts
Created May 25, 2022 17:49 — forked from jacob-ebey/image.ts
Remix Image Component
import { createHash } from "crypto";
import fs from "fs";
import fsp from "fs/promises";
import path from "path";
import https from "https";
import { PassThrough } from "stream";
import type { Readable } from "stream";
import type { LoaderFunction } from "remix";
import sharp from "sharp";
import type { Request as NodeRequest } from "@remix-run/node";
@AnthoniG
AnthoniG / sw-test-cleaup.js
Created May 3, 2022 10:52 — forked from gauntface/sw-test-cleaup.js
Function to unregister SW and clear out old caches.
window.__testCleanup = () => {
const unregisterSW = () => {
return navigator.serviceWorker.getRegistrations()
.then((registrations) => {
const unregisterPromise = registrations.map((registration) => {
return registration.unregister();
});
return Promise.all(unregisterPromise);
});
};
@AnthoniG
AnthoniG / Skrotlin.kt
Created April 22, 2022 15:11 — forked from marquesds/Skrotlin.kt
A simple web scraping with Kotlin
// Crawler.kt
import kotlinx.coroutines.*
import org.json.JSONObject
import org.jsoup.Jsoup
import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
import org.jsoup.select.Elements
class Crawler {