Skip to content

Instantly share code, notes, and snippets.

@MrSaints
MrSaints / console-scripts.js
Created January 7, 2025 13:51
Console scripts for semi-automating https://neal.fun/stimulation-clicker/.
let clickClicker = setInterval(() => {
[...document.querySelectorAll('button')].find(btn => btn.textContent.trim() === 'Click me')?.click();
document.querySelector('.google-btn')?.click()
}, 100);
let hydraulicClicker = setInterval(() => {
document.querySelector('.hydraulic-press .press-btn:not(.press-btn-hide)')?.click();
document.querySelector('.hydraulic-press .press-collect:not(.press-collect-hide)')?.click();
}, 1000);
@MrSaints
MrSaints / external_database.php
Last active November 21, 2022 12:32
A custom database class to demonstrate how WordPress' wpdb class can be instantiated and extended to allow you to connect to another / an external or secondary database. The global $wpdb object is only capable of communicating with the WordPress database. Refer to http://codex.wordpress.org/Class_Reference/wpdb for more information.
<?php
/*
The MIT License (MIT)
Copyright © 2014 Ian Lai
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the “Software”), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@MrSaints
MrSaints / angular_data.html
Last active October 19, 2022 09:42
A simple AngularJS application to add / delete / list / sort data comprising of three fields (state code, price and tax). It was written to demonstrate to a friend, the simplicity and power of Angular to address programming challenges - in recruitment processes - quickly and effectively.
<!DOCTYPE html>
<html ng-app>
<head>
<title>Add / List Data (AngularJS)</title>
<style>
.list_data { margin-bottom: 2rem }
table, th, td { border: 1px solid #AAA }
th { cursor: pointer }
</style>
</head>
@MrSaints
MrSaints / go-qthtml2pdf.go
Last active January 6, 2020 22:30
A basic HTML to PDF converter in Golang using Qt WebEngine 5.7. For a more production-ready converter, see: http://www.athenapdf.com/
package main
import (
"flag"
"fmt"
"github.com/therecipe/qt/core"
"github.com/therecipe/qt/gui"
"github.com/therecipe/qt/webengine"
"github.com/therecipe/qt/widgets"
"os"

Keybase proof

I hereby claim:

  • I am MrSaints on github.
  • I am mrsaints (https://keybase.io/mrsaints) on keybase.
  • I have a public key whose fingerprint is 23EB 5004 75C1 2A47 6D3E FE59 E45D 4BB2 8169 BA4F

To claim this, I am signing this object:

@MrSaints
MrSaints / demo.html
Last active December 3, 2017 21:22
Native ports of Morphext in React and Polymer (JavaScript frameworks). They're a work in progress. Use them at your own risk. Original: https://github.com/MrSaints/Morphext
<!doctype html>
<html class="no-js" lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Morphext Web Components (v2.0.0)</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
go build -ldflags "-X http://main.build =$(git rev-parse --short HEAD)"
https://github.com/kovetskiy/go-fast
@MrSaints
MrSaints / priority_tree.go
Created July 14, 2017 21:32
A radix trie inspired structure with priority queues.
package converter
import (
"container/heap"
"mime"
"strings"
)
type ConverterPriorityQueueItem struct {
converter Converter
@MrSaints
MrSaints / command.go
Last active June 26, 2017 10:06
A wrapper around `exec.Command(...).Output()` to execute external commands / binaries with support for cancellation signals via channels (i.e. terminate the running process).
package main
import (
"errors"
"log"
"os/exec"
)
var (
ErrCmdCancelled = errors.New("command cancelled")
@MrSaints
MrSaints / main.go
Created May 25, 2017 16:15
Coffee shop concurrency. Examining concurrency in the real world by scaling a coffee shop's efficiency.
package main
import (
"fmt"
"github.com/icrowley/fake"
"math/rand"
"time"
)
const (