- hello.tski.dev:8000
- https://gitlab.com/t-ski
- https://rapidjs.org
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script src="https://unpkg.com/@t-ski/html-sourcecode-element/dist/HTMLSourceCodeElement.common.glitch.js"></script> | |
<script src="https://unpkg.com/@highlightjs/cdn-assets/highlight.min.js"></script> | |
<script> | |
HTMLSourceCodeElement.on("highlight", (code, language) => { | |
return language | |
? hljs.highlight(code, { language }).value | |
: hljs.highlightAuto(code).value; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function prettyJSONStringify(value: string) { | |
const color = (str: string, colorCode: number): string => { | |
const escape = `\x1b[${ | |
Array.isArray(colorCode) | |
? `38;2;$${colorCode.join(";")}` | |
: colorCode | |
}m`; | |
return `${escape}${str.replace(/(\x1b\[39m)/g, `$1${escape}`)}\x1b[39m` | |
}; | |
const format = (value: string): string => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn get_index(name: &str, shorthand: Option<&str>) -> Option<usize> { | |
let args: Vec<String> = std::env::args().collect(); | |
let index = args.iter().position(|s| *s.to_lowercase() == format!("--{}", name.to_lowercase())); | |
let shorthand_index = args | |
.iter() | |
.position(|s| *s.to_lowercase() == format!("-{}", shorthand.unwrap_or("").to_lowercase())); | |
return match index != None || shorthand_index != None { | |
true => Some(std::cmp::min(index.unwrap_or(args.len()), shorthand_index.unwrap_or(args.len()))), | |
false => None | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AsyncMutex { | |
constructor() { | |
this.acquireQueue = []; | |
this.isLocked = false; | |
} | |
lock(callback) { | |
return new Promise(resolveOuter => { | |
new Promise(resolveInner => { | |
if(this.isLocked) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
git add . | |
git commit -m "$1" | |
git reset --soft HEAD~1 | |
git commit --amend --no-edit | |
git push --force |