Skip to content

Instantly share code, notes, and snippets.

@gingkapls
gingkapls / waybar-config
Created December 21, 2020 14:08
Wayland recording with waybar indicator
"custom/wf-recorder": {
"format": "{}",
"interval": "once",
"exec": "echo ''",
"tooltip": "false",
"exec-if": "pgrep 'wf-recorder'",
"on-click": "exec $HOME/.scripts/wlrecord.sh",
"signal": 8
}
@christhekeele
christhekeele / 1-indirect_uses_tracker.ex
Last active November 29, 2024 21:29
Elixir metaprogramming module usage: A way to track when certain modules are used, and an example adapter/plugin architecture built on top.
# For simpler use cases, see the UsesTracker instead:
# https://gist.github.com/christhekeele/e858881d0ca2053295c6e10d8692e6ea
###
# A way to know, at runtime, what modules a module has used at compile time.
# In this case, you include `IndirectUsesTracker` into a module. When that module gets
# used in some other module, it makes that module registerable under a namespace of your choosing.
# When the registerable module is used into a third module, that third module will know at runtime which
# registerables were `use`d in it at compile time, via a function titled after the namespace.
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}