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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>SVG with border radius</title> | |
</head> | |
<body> | |
<svg width="400" height="400" viewBox="0 0 400 400"> | |
<defs> |
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
CREATE TABLE things ( | |
id int NOT NULL AUTO_INCREMENT PRIMARY KEY, | |
created timestamp NULL DEFAULT CURRENT_TIMESTAMP, | |
str varchar(10), | |
expires timestamp | |
); | |
INSERT INTO things (str) VALUES ('one'); | |
CREATE TRIGGER set_thing_expires |
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
SELECT CURRENT_TIMESTAMP; | |
+---------------------+ | |
| current_timestamp | | |
+---------------------+ | |
| 2023-07-23 13:28:42 | | |
+---------------------+ | |
# subtract 10 minutes from current timestamp | |
SELECT DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 10 MINUTE); |
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
autoload -Uz vcs_info | |
precmd() { vcs_info } | |
zstyle ':vcs_info:git:*' formats '- %b' | |
zstyle ':vcs_info:*' check-for-changes true | |
setopt PROMPT_SUBST | |
PROMPT='${PWD/#$HOME/~} %F{white}%B${vcs_info_msg_0_}%b%f | |
%# ' |
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
const monthLabels = Array(12) | |
.fill() | |
.map((_, i) => new Date(`${i+1}`).toDateString()) | |
.map(date => date.slice(4, 7)) | |
export default monthLabels | |
// ['Jan', 'Feb', 'Mar', ...'Dec'] |
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
import { fromPairs, is, map, pipe, toPairs } from 'ramda' | |
const isObject = is(Object) | |
const transformKey = transform => | |
([k, v]) => !isObject(v) ? [transform(k), v] : | |
[transform(k), mapKeys(transform)(v)] | |
const mapKeys = transform => | |
pipe( |
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
const mapObj = (fn, obj) => | |
Object.entries(obj).map(([key, value]) => { | |
return fn(value, key) | |
}) |
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
import { fromPairs, map, path, pipe, split, tail } from 'ramda' | |
const removeEmptyQuery = filter(complement(isNil)) | |
const getQueryParams = pipe( | |
path(['location', 'search']), | |
tail, | |
split('&'), | |
map(split('=')), | |
fromPairs, |
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
<script> | |
let x | |
</script> | |
<p>markup</p> | |
<style> | |
body { | |
background: white; | |
} |
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
const replace = replacements => str => { | |
const fragmentsToReplace = Object.keys(replacements).join('|') | |
const regex = new RegExp(fragmentsToReplace, 'g') | |
return str.replace(regex, match => replacements[match]) | |
} |
NewerOlder