Skip to content

Instantly share code, notes, and snippets.

@DavidMikeSimon
DavidMikeSimon / init.lua
Created September 20, 2021 17:56
Hammerspoon script for switching between screens
--------
-- Window switching
--------
screenWindowFilters = {}
previewSequences = {}
log = hs.logger.new("WAT")
hs.window.animationDuration = 0
function resetPreviewSequences()
@DavidMikeSimon
DavidMikeSimon / zoom_ptt.lua
Created June 29, 2021 21:36
My little Hammerspoon script for Zoom
-----------
-- Zoom PTT in Hammerspoon
-----------
function withZoomApp(fun)
local app = hs.application.get("zoom.us")
if (app ~= nil) then
fun(app)
end
end
@DavidMikeSimon
DavidMikeSimon / init.lua
Created May 21, 2021 20:16
Hammerspoon zoom config
function withZoomApp(fun)
local app = hs.application.get("zoom.us")
if (app ~= nil) then
fun(app)
end
end
function pttDown()
withZoomApp(function(app)
hs.eventtap.event.newKeyEvent("space", true):post(app)
@DavidMikeSimon
DavidMikeSimon / foo.rb
Last active December 13, 2019 00:23
Ruby DRY vs DAMP
def shout(msg)
puts "#{msg}!!!"
end
def shout_twice(msg)
puts "#{msg}!!! #{msg}!!!"
end
def louden(msg)
"#{msg}!!!"
@DavidMikeSimon
DavidMikeSimon / vim-on-heroku.sh
Created July 15, 2019 21:57 — forked from sfate/vim-on-heroku.sh
vim on heroku
set -e
if [[ ! -d ~/vim ]]; then
echo "Downloading vim..."
mkdir ~/vim
cd ~/vim
# Staically linked vim version compiled from https://github.com/ericpruitt/static-vim
# Compiled on Jul 20 2017
"cards":[{"artist":"Richard Thomas","cmc":5,"colorIdentity":["U"],"colors":["Blue"],"flavor":"These spirits of the air are winsome and wild, and cannot be truly contained. Only marginally intelligent, they often substitute whimsy for strategy, delighting in mischief and mayhem.","id":"926234c2fe8863f49220a878346c4c5ca79b6046","imageName":"air elemental","layout":"normal","manaCost":"{3}{U}{U}","mciNumber":"47","multiverseid":94,"name":"Air Elemental","power":"4","rarity":"Uncommon","subtypes":["Elemental"],"text":"Flying","toughness":"4","type":"Creature — Elemental","types":["Creature"]},{"artist":"Mark Poole","cmc":1,"colorIdentity":["U"],"colors":["Blue"],"id":"aa74b7dc3b30b2e7559598f983543755e226811d","imageName":"ancestral recall","layout":"normal","manaCost":"{U}","mciNumber":"48","multiverseid":95,"name":"Ancestral Recall","rarity":"Rare","reserved":true,"text":"Target player draws three cards.","type":"Instant","types":["Instant"]},{"artist":"Douglas Shuler","cmc":4,"colorIdentity":["U"],"colors":["Bl
arr = (1..10).to_a
enumerator = arr.select.each {|i| puts "AT #{i}"; i > 2}
puts "ANY? #{enumerator.any?}"
@DavidMikeSimon
DavidMikeSimon / gist:b994f9904dc02a26b0bd
Last active August 29, 2015 14:24
Well-known and frequently-mentioned games from IFComps
A Change in the Weather by Andrew Plotkin (1995, 1st Place tie): http://ifdb.tads.org/viewgame?id=00wlim27k5d1hmf2
Photopia by Adam Cadre (1998, 1st Place): http://ifdb.tads.org/viewgame?id=ju778uv5xaswnlpl
For a Change by Dan Schmidt (1999, 2nd Place): http://ifdb.tads.org/viewgame?id=t61i5akczyblx2zd
All Roads by Jon Inglod (2001, 1st Place): http://ifdb.tads.org/viewgame?id=4s7uohdncurgqb0h
Floatpoint by Emily Short (2006, 1st Place): http://ifdb.tads.org/viewgame?id=01efmfsk4r79mtks
@DavidMikeSimon
DavidMikeSimon / gist:a3d408bad1b2192faa1c
Created April 7, 2015 18:16
Auth by cookie OR password
Order allow,deny
Require valid-user
Satisfy any
AuthType Basic
AuthName "Protected Login"
AuthUserFile /path/to/.htpasswd
SetEnvIf Cookie "(/api/.(.*))$" is_sample_cookie=yes
Allow from env=is_sample_cookie
function mystery() {
var timeout = setTimeout(function() { console.log("foo"); }, 1);
reallySlowFunction();
clearTimeout(timeout);
}