Skip to content

Instantly share code, notes, and snippets.

View UltiRequiem's full-sized avatar
🏠
Working from home

Eliaz Bobadilla UltiRequiem

🏠
Working from home
View GitHub Profile
import { Buffer } from "../buffer.ts";
export interface CheckPrimeOptions {
checks?: number | undefined;
}
export function checkPrime(
candidate: ArrayBuffer | bigint,
options: CheckPrimeOptions = {},
);
@UltiRequiem
UltiRequiem / script.js
Last active November 26, 2021 00:24
No more Quizizz
function getQuestionsElement() {
const questionsElem = document.querySelector(
"body > div > div.root-component > div > div > div > div.page-container.in-quiz > div.screen.screen-game > div.transitioner.transitioner-component > div > div > div > div > div > div.options-container > div"
);
if (!questionsElem) throw new Error("Unable to retrieve questions list element.");
return questionsElem;
}
@UltiRequiem
UltiRequiem / install.sh
Last active November 26, 2021 22:23
simplex-chat installer
# Constants
VERSION="v0.4.2"
SIMPLEX_CHAT="simplex-chat"
######################
PLATAFORM=""
if [ "$(uname)" == "Darwin" ]; then
PLATAFORM="macos-x86-64"
elif [ "$(uname)" == "Linux" ]; then
import re
def translate_g_language(text: str) -> str:
return re.sub(r"([aeiou])g\1", r"\1", text)
def main():
print(f"Result: {translate_g_language(input('Enter text: '))}")
@UltiRequiem
UltiRequiem / program.cs
Created December 16, 2021 16:18
Minimal API
var app = WebApplication.Create(args);
app.MapGet("/reverse/{text}", RouteHandlers.Reverse);
app.Run();
internal static class RouteHandlers
{
public static string Reverse(string text)
{
@UltiRequiem
UltiRequiem / pizza.ts
Created January 13, 2022 20:31
The Builder patron, a pizza
export enum PizzaShapes {
square,
rectangular,
circular,
}
export type PizzaToppings = "sausage" | "mushrooms" | "cabanossi";
export type PizzaFlavor =
| "veggie"
| "meat"
@UltiRequiem
UltiRequiem / cars_builder.js
Created January 13, 2022 20:40
Builder Patron JavaScript
class VehiclesFactory {
static build(builder) {
builder.addParts();
return builder.get();
}
}
class CarBuilder {
constructor() {
this.car = new Car();
use colored::Colorize;
use open::that;
use std::{io::prelude::*, net};
// TODO: Manage Request asynchronously
pub async fn serve(app: &str, addr: &str, open_on_browser: bool) {
let listener = net::TcpListener::bind(&addr)
.unwrap_or_else(|e| panic!("Port {} is already used: {}", &addr, e));