- https://grafikart.github.io/headless-elements/?path=/docs/scroll-top--default-story
- Github Time Elements by GitHub.
- Router Manager by Erik Ringsmuth.
- Responsive Embed by Joselito Júnior. Add YouTube, Vimeo and other multimedia content to your pages, letting the browser calculate the height based on the width of their containing block. You just have to define the aspect ratio of the media.
- Lottie Player
This file contains 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
llmc() { | |
local system_prompt='Output a command that I can run in a ZSH terminal on macOS to accomplish the following task. Try to make the command self-documenting, using the long version of flags where possible. Output the command first enclosed in a "```zsh" codeblock followed by a concise explanation of how it accomplishes it.' | |
local temp_file=$(mktemp) | |
local capturing=true | |
local command_buffer="" | |
local first_line=true | |
local cleaned_up=false # Flag to indicate whether cleanup has been run | |
cleanup() { | |
# Only run cleanup if it hasn't been done yet |
This file contains 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 stack | |
-- stack --resolver lts-18.8 script | |
{-# LANGUAGE OverloadedStrings #-} | |
{- | |
This is a handy illustration of converting between five of the commonly-used | |
string types in Haskell (String, ByteString, lazy ByteString, Text and lazy | |
Text). |
This file contains 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 stack | |
{- stack exec | |
--verbosity info | |
--package webdriver | |
-- ghc | |
-} | |
--package data-default | |
-- stack exec ghci wellsfargo | |
-- stack exec ghc wellsfargohs | |
-- |
This file contains 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
// | |
// This scripts builds wget commands for you to paste into a terminal. It will download | |
// all formats of all books currently showing on the page. | |
// | |
cmds = ""; | |
for (a of document.getElementsByTagName("a")) { | |
if (a.href.startsWith("https://dl.humble.com")) cmds += "wget --content-disposition '" + a.href + "'<br>"; | |
}; |
This file contains 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
instance Arbitrary Aeson.Value where | |
arbitrary = sized sizedArbitraryValue | |
sizedArbitraryValue :: Int -> Gen Aeson.Value | |
sizedArbitraryValue n | |
| n <= 0 = oneof [pure Aeson.Null, bool, number, string] | |
| otherwise = resize n' $ oneof [pure Aeson.Null, bool, number, string, array, object'] | |
where | |
n' = n `div` 2 | |
bool = Aeson.Bool <$> arbitrary |
[ Update 2020-05-31: I won't be maintaining this page or responding to comments anymore (except for perhaps a few exceptional occasions). ]
Most of the terminal emulators auto-detect when a URL appears onscreen and allow to conveniently open them (e.g. via Ctrl+click or Cmd+click, or the right click menu).
It was, however, not possible until now for arbitrary text to point to URLs, just as on webpages.
This file contains 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
#!/bin/bash | |
echo "*** SVG 2 ICNS ***" | |
if [ $# -ne 1 ]; then | |
echo "Usage: svg2icns filename.svg" | |
exit 100 | |
fi | |
filename="$1" | |
name=${filename%.*} | |
ext=${filename##*.} | |
echo "processing: $name" |
Advantages compared to using symbols as enum values:
- Enum values are much more customizable. For example, one can have custom prototype and/or instance methods.
- Enum values get two custom properties:
name
provides direct access to the name of an enum value.ordinal
holds a number, the position of the enum value. Useful for some applications.
- One can use
instanceof
to test whether a value is an element of an enum. - One occasionally requested feature for enums is that enum values be numbers (e.g. for flags) or strings (e.g. to compare with values in HTTP headers). That can be achieved by making those values properties of enum values. For an example, see
enum Mode
, below.
Static properties of enums:
This file contains 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
WITH RECURSIVE | |
unhex(str, val, weight) AS ( | |
SELECT 'deadbeef', 0, 1 | |
UNION ALL | |
SELECT | |
substr(str, 1, length(str) - 1), | |
val + (instr('0123456789ABCDEF', substr(str, length(str), 1)) - 1) * weight, | |
weight * 16 | |
FROM unhex WHERE length(str) > 0 | |
) |
NewerOlder