This file contains hidden or 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
// Icons (source: https://css.gg) | |
.gg-notes { | |
box-sizing: border-box; | |
position: relative; | |
display: block; | |
width: 20px; | |
height: 22px; | |
border: 2px solid; | |
border-radius: 3px; |
This file contains hidden or 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
export function humanizeBytes(bytes: number): string { | |
if (bytes < 1000) return bytes + ' B'; | |
const kb = bytes / 1000; | |
if (kb < 1000) return kb.toFixed(2) + ' KB'; | |
const mb = kb / 1000; | |
if (mb < 1000) return mb.toFixed(2) + ' MB'; | |
const gb = mb / 1000; |
This file contains hidden or 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Code Scroll 📜</title> | |
</head> | |
<body> | |
<script> | |
const sampleSource = ` |
This file contains hidden or 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
// clear && gcc -std=c++17 -pthread -O2 randym.cpp && time ./a.out | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <pthread.h> | |
#include <unistd.h> | |
#include <sys/time.h> | |
using u64 = unsigned long long int; |
This file contains hidden or 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
#!/usr/bin/env node | |
const { execSync } = require('child_process') | |
const [inputScript] = process.argv.slice(2) | |
const outputScript = inputScript.slice(0, -3) + '.js' | |
console.log('Compiling...') | |
execSync(`./node_modules/.bin/tsc --target ESNext --module CommonJS --outDir /tmp ${inputScript}`, { stdio: 'inherit' }) |
This file contains hidden or 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
import * as Vuex from 'vuex'; | |
import type * as Vue from 'vue'; | |
type CommitOptions = Omit<Vuex.CommitOptions, 'root'>; | |
type DispatchOptions = Omit<Vuex.DispatchOptions, 'root'>; | |
type ThenArg<T> = T extends PromiseLike<infer U> ? U : T; | |
/** | |
* Create a type-safe Vuex store. |
This file contains hidden or 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
# Requirements: | |
# sudo apt install libsdl2-dev | |
export LITE_SCALE=1.8 | |
alias lite=~/Programs/lite/lite |
This file contains hidden or 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
[alias] | |
st = status | |
co = checkout | |
ci = commit | |
# Undo commit. This resets HEAD, so the currently checked out commit to its parent. It should only be used when you | |
# have accidentally committed something and want it to be "uncommited" again. So it takes all changes of the latest | |
# commit back to "local" changes. | |
uci = reset HEAD~ |
This file contains hidden or 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
import { Html } from '../components/Html' | |
const context = Html('canvas').getContext('2d')! | |
export function getTextWidth(text: string, fontSize: number, fontFamily = 'system-ui, sans-serif') { | |
context.font = `${fontSize}px ${fontFamily}` | |
return context.measureText(text).width | |
} |