Skip to content

Instantly share code, notes, and snippets.

View hauntedhost's full-sized avatar
💭
👻

Jules Omlor hauntedhost

💭
👻
View GitHub Profile
@liamcain
liamcain / obsidian-debug-mobile.js
Last active April 22, 2024 05:57
Save console messages to logfile for mobile debugging
declare module "obsidian" {
interface App {
isMobile: boolean;
}
}
// Call this method inside your plugin's `onLoad` function
function monkeyPatchConsole(plugin: Plugin) {
if (!plugin.app.isMobile) {
return;

About variadics in Rust

This is an analysis of how variadic generics could be added to Rust. It's not a proposal so much as a summary of existing work, and a toolbox for creating an eventual proposal.

Introduction

Variadic generics (aka variadic templates, or variadic tuples), are an often-requested feature that would enable traits, functions and data structures to be generic over a variable number of types.

To give a quick example, a Rust function with variadic generics might look like this:

#!/bin/bash
###
### my-script — does one thing well
###
### Usage:
### my-script <input> <output>
###
### Options:
### <input> Input file to read.
### <output> Output file to write. Use '-' for stdout.
@jarmitage
jarmitage / avril.tidal
Created April 14, 2020 20:37
Avril 14th
-- happy avril 14th :)))))))))))))))))))))))))))))))))))))))
do
let bars = 4
key = "8"
righthand = "[[4 -3] [0 _ _ _ _ _ 0]] [[-3, -8] [7 5 4 0]]"
lefthand = "[0 9 12 16] [4 12 16 19] [5 12 17 19] [2 12 17 16]"
d1 $ slow bars
$ stack [
n (righthand + key + "<24 36>/2"),
@thepeoplesbourgeois
thepeoplesbourgeois / allEventListeners.js
Last active September 1, 2023 02:18 — forked from tkafka/listAllEventListeners.js
List all event listeners in a document
function allEventListeners(){
const eventNames = Object.keys(window).filter(key => /^on/.test(key))
return [...document.querySelectorAll('*'), document].flatMap((node) => eventNames
.filter(event => node[event])
.map(event => {
return {
node,
event,
listener: (typeof node[event] === 'function') ? node[event].toString() : node[event]
}
@leodutra
leodutra / index.js
Last active November 5, 2022 23:21 — forked from shospodarets/Chrome headless Puppeteer- capture DOM element screenshot using
Capture DOM elements screenshot using Chrome headless
const puppeteer = require('puppeteer')
// Related Issues:
// 3118 - https://github.com/GoogleChrome/puppeteer/issues/3118#issuecomment-417754246
async function main() {
const browser = await puppeteer.launch({
args: ['--start-maximized'],
headless: false,
defaultViewport: null
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jeromecoupe
jeromecoupe / webstoemp-gulpfile.js
Last active January 21, 2024 16:28
Gulp 4 sample gulpfile.js. For a full explanation, have a look at https://www.webstoemp.com/blog/switching-to-gulp4/
"use strict";
// Load plugins
const autoprefixer = require("autoprefixer");
const browsersync = require("browser-sync").create();
const cp = require("child_process");
const cssnano = require("cssnano");
const del = require("del");
const eslint = require("gulp-eslint");
const gulp = require("gulp");
@Jannis
Jannis / build.clj
Last active May 6, 2020 10:47
Using GraphQL / Apollo Client / React Apollo in the next ClojureScript release
;; Run using a local build of ClojureScript master, e.g.:
;; clj -Sdeps '{:deps {org.clojure/clojurescript {:mvn/version "1.10.155"}}}' -i build.clj
(require '[cljs.build.api :as b])
(b/watch "src"
{:output-dir "out"
:output-to "out/main.js"
:optimizations :none
:verbose true
@shihanng
shihanng / .chunkwmrc
Last active January 6, 2024 04:17
chunkwm + skhd
#!/bin/bash
#
# NOTE: specify the absolutepath to the directory to use when
# loading a plugin. '~' expansion is supported.
#
chunkc core::plugin_dir /usr/local/opt/chunkwm/share/chunkwm/plugins
#