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
<?php | |
function guardWithModulo($d, $s) | |
{ | |
return function ($i) use ($d, $s) { | |
return ($i % $d === 0) ? $s : null; | |
}; | |
} | |
$cbs = [ |
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
version: '3' | |
networks: | |
reverse-proxy: {} | |
wp-test: {} | |
volumes: | |
wp-test-db: {} | |
services: |
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
function print(arg) { | |
document.body.innerText += arg + "\n"; | |
} | |
function fizzBuzz(c = [3, 5], l = 100, o = 1) { // c = checks, l = limit, o = offset | |
return new Array(l + o) // +o because ignore zero | |
.fill(undefined) // can't map over uninitialized arrays | |
.map((_, i) => // 0 <= i < limit | |
c.reduce((a, c, j) => // a = accumulator, c = check, 0 <= j < checks.length | |
(i % c === 0) // if we've hit a Fizz/Buzz number |
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
def fb(cs = [3, 5], l = 100, o = 1): | |
for i in range(o, l): | |
o = "" | |
for j, c in enumerate(cs): | |
if i % c == 0: | |
o += "Fizz" if j % 2 == 0 else "Buzz" | |
print(o or i) |
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
:root { | |
--background-color: whitesmoke; | |
--header-height: 2em; | |
--margin-end: 1em; | |
--margin-gap: 1px; | |
--margin-color: red; | |
--margin-right: 0.25em; |
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
let data = Array.from(document.querySelectorAll(".commands-container h2")).map( | |
(el) => { | |
return { | |
heading: el.textContent, | |
items: Array.from(el.nextElementSibling.children).map((el) => { | |
const [answers, ...description] = el.textContent | |
.trim() | |
.split(/\s+-\s+/); | |
return { | |
description: description.join(" - "), |
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 sh | |
NAME='repo' | |
# abort on errors | |
set -e | |
# build | |
npm run build | |
# navigate into the build output directory |
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
(function () { | |
const timeout = 5000; | |
const start = performance.now(); | |
const interval = setInterval(() => { | |
const popup = document.querySelector('[data-testid="sheetDialog"] svg'); | |
console.log(popup); | |
if (!popup || performance.now() - start > timeout) | |
return clearInterval(interval); | |
if (popup) popup.parentElement.click(); | |
}, 100); |
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
# | |
# ~/.bashrc | |
# | |
# If not running interactively, don't do anything | |
[[ $- != *i* ]] && return | |
export BROWSER="brave-bin" | |
export _JAVA_AWT_WM_NONREPARENTING=1 # dwm support for phpstorm | |
export PATH="$PATH:$HOME/code/scripts" |
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
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "Left", function() | |
local win = hs.window.focusedWindow() | |
local f = win:frame() | |
local screen = win:screen() | |
local max = screen:frame() | |
f.x = max.x | |
f.y = max.y | |
f.w = max.w / 2 | |
f.h = max.h |