Skip to content

Instantly share code, notes, and snippets.

View CompilerCache.cpp
struct CompilerCache: soul::patch::RefCountHelper<soul::patch::CompilerCache, CompilerCache> {
std::mutex mutex;
std::filesystem::path path;
CompilerCache(std::filesystem::path path): path(path) {
std::filesystem::create_directory(path);
}
void storeItemInCache(const char* key, const void* source, uint64_t sourceSize) override {
std::scoped_lock lock(mutex);
std::ofstream file(this->path / key, std::ifstream::out | std::ifstream::binary);
file.write((char*) source, sourceSize);
@kofigumbs
kofigumbs / slack.js
Created December 21, 2020 20:31
Muti, reload Slack on disconnect
View slack.js
setInterval(() => {
if (document.body.innerText.includes('Load new messages.'))
window.location.reload();
}, 90000)
@kofigumbs
kofigumbs / links.css
Created December 21, 2020 20:29
Multi, display link targets
View links.css
@kofigumbs
kofigumbs / dnd.js
Created December 21, 2020 20:27
Multi, url drag & drop
View dnd.js
document.addEventListener("dragover", e => e.preventDefault())
@kofigumbs
kofigumbs / links.js
Created December 21, 2020 20:25
Multi, fix GSuite links
View links.js
@kofigumbs
kofigumbs / find.js
Created December 21, 2020 20:19
Multi find, Cmd-F
View find.js
(() => {
const highlightResults = (text, color) => {
document.designMode = "on"; // https://stackoverflow.com/a/5887719
var selection = window.getSelection();
selection.collapse(document.body, 0);
while (window.find(text)) {
document.execCommand("HiliteColor", false, color);
selection.collapseToEnd();
}
document.designMode = "off";
@kofigumbs
kofigumbs / config.json
Last active December 19, 2020 22:42
Multi internal links
View config.json
{
"tabs": [
{
"title": "Substack Reader",
"url": "https://reader.substack.com",
"customJs": ["https://gist.githubusercontent.com/kofigumbs/4a9708a35807dd16f2541dc3204d6a25/raw/1579800b262aee48a3c731e0f00e3ce2d20cca01/link.js"]
}
]
}
@kofigumbs
kofigumbs / url.js
Created December 17, 2020 03:58
Multi URL bar, Cmd-K
View url.js
document.addEventListener("keydown", event => {
if (event.metaKey && event.key === "k") {
event.preventDefault();
const input = document.createElement("input");
input.required = true;
input.type = "url";
input.placeholder = "URL";
input.style.position = "absolute";
input.style.top = "0";
View kodelife-image-animation.glsl
#version 150
uniform float time;
uniform vec2 resolution;
uniform sampler2D bitmoji;
in VertexData
{
vec4 v_position;
vec3 v_normal;