Skip to content

Instantly share code, notes, and snippets.

Avatar
:shipit:
Eloquent JavaScript

Eliaz Bobadilla UltiRequiem

:shipit:
Eloquent JavaScript
View GitHub Profile
View nestedError.ts
export class NestedError<ErrorLike extends Error> extends Error {
private nestedError: ErrorLike;
constructor(config: { message?: string; nestedError: ErrorLike }) {
const { message = "", nestedError } = config;
super(message);
this.nestedError = nestedError;
@UltiRequiem
UltiRequiem / denoRun.ts
Last active Mar 30, 2022
Run a deno subcommand
View denoRun.ts
export function denoRun(args: string[], options: Partial<Deno.RunOptions> = {}) {
return Deno.run({
cmd: ["deno", ...args],
stdout: "null",
stderr: "null",
...options,
});
}
@UltiRequiem
UltiRequiem / lint.ts
Created Mar 30, 2022
Check and Lint deno code format
View lint.ts
#!/usr/bin/env -S deno run --allow-run
const checkFormatprocess = Deno.run({
cmd: ["deno", "fmt", "--check", "."],
stdout: "null",
stderr: "null",
});
const lintProcess = Deno.run({
cmd: ["deno", "lint", "."],
@UltiRequiem
UltiRequiem / brainfuck.cpp
Created Feb 25, 2022
A simple, not completly working Brain F**ck compiler on C++ | When did I learn C++???
View brainfuck.cpp
#include <fstream>
#include <iostream>
#define SOURCE_SIZE 10000
#define MEMORY_SIZE 30000
using std::cout;
using std::endl;
void bf_execute(char *src, int *mem, int loop) {
View over_complicated.py
VALID_VOWELS = ["A", "E", "I", "O", "U", "a", "e", "i", "o", "u"]
consonants = "bcdfghjklmnpqrstvwxz" + "BCDFGHJKLMNPQRSTVWXZ"
def is_vowel(string):
return string in VALID_VOWELS
RULERS = {"vowels": "Alice", "consonants": "Bob", "y": "nobody"}
@UltiRequiem
UltiRequiem / main.rs
Created Feb 7, 2022
get env vars rust
View main.rs
use std::env;
const DEFAULT_PORT: u16 = 3000;
const DEFAULT_SERVER_MODE: &str = "DEV";
fn main() {
let server_port = env::var("SERVER_PORT").unwrap_or(DEFAULT_PORT.to_string());
let server_mode = env::var("SERVER_MODE").unwrap_or(DEFAULT_SERVER_MODE.to_string());
println!(
View dissect_old_collector.go
package main
import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"log"
View gpu.render.canvas.js
const size = 10.0;
const clr = 0.0;
const ps = 0.0;
rust
.then((canvas) => {
var nodes = document.getElementsByTagName("button");
for (var i = 0; i < nodes.length; i++) {
nodes[i].addEventListener(
@UltiRequiem
UltiRequiem / swc_tsx.rs
Created Jan 27, 2022
Got swc working for tsx, pogs
View swc_tsx.rs
use std::{path::Path, sync::Arc};
use swc::{
self,
config::{JscConfig, Options},
};
use swc_common::{
errors::{ColorConfig, Handler},
SourceMap,
};
@UltiRequiem
UltiRequiem / server.rs
Created Jan 26, 2022
rust websockets (not working)
View server.rs
use colored::Colorize;
use open::that;
use std::{
io::prelude::*,
net::{TcpListener, TcpStream},
};
use tungstenite::{
accept_hdr,
handshake::server::{Request, Response},
};