Skip to content

Instantly share code, notes, and snippets.

View swiftui preview build step - quit early.sh
#!/usr/bin/env bash
if [ "${ENABLE_PREVIEWS}" = "YES" ]; then
echo "Previews enabled, quitting to prevent 'preview paused'."
exit 0;
fi
# ... rest of the script ...
# Success? Clear the exit code that might have been left here by a last command of the script.
@tkafka
tkafka / .swiftformat
Created Jul 16, 2021
Failure of swiftformat 0.48.9 - the `--self init-only` directive causes `error: Unexpected class/static func on line 10 in Test.swift.`
View .swiftformat
--swiftversion 5
--self init-only
View StringPadding.swift
extension String {
func padding(leftTo paddedLength: Int, withPad pad: String = " ", startingAt padStart: Int = 0) -> String
{
if count < paddedLength {
let rightPadded = padding(toLength: max(count, paddedLength), withPad: pad, startingAt: padStart)
return "".padding(toLength: paddedLength, withPad: rightPadded, startingAt: count % paddedLength)
} else {
return self
}
}
@tkafka
tkafka / opengraph.template.html
Last active Mar 16, 2020 — forked from druellan/opengraph.template.html
Basic template for OpenGraph/Facebook metatags
View opengraph.template.html
Detail
<html prefix="og: http://ogp.me/ns#">
<head>
<title>{advert.title ořezaný na 60 znaků, případně s trojtečkou pokud jsme ho ořezali} · dobro.cz</title> <!-- ˜60 chars -->
<meta name="description" content="Nabídka pomoci na dobro.cz — pomáhejme si v době koronaviru"> <!-- Nabidka ˜150 chars -->
<meta name="description" content="Žádost o pomoc na dobro.cz — pomáhejme si v době koronaviru"> <!-- Poptavka ˜150 chars -->
<meta property="og:title" content="{advert.title}">
<meta property="og:description" content="Nabídka pomoci na dobro.cz — pomáhejme si v době koronaviru"> <!-- Nabidka -->
<meta property="og:description" content="Žádost o pomoc na dobro.cz — pomáhejme si v době koronaviru"> <!-- Poptavka -->
@tkafka
tkafka / listAllEventListeners.js
Last active Aug 22, 2021 — forked from dmnsgn/listAllEventListeners.js
List all event listeners in a document
View listAllEventListeners.js
console.table((function listAllEventListeners() {
const allElements = Array.prototype.slice.call(document.querySelectorAll('*'));
allElements.push(document); // we also want document events
const types = [];
for (let ev in window) {
if (/^on/.test(ev)) types[types.length] = ev;
}
let elements = [];
for (let i = 0; i < allElements.length; i++) {
@tkafka
tkafka / install_git_lfs.sh
Last active May 31, 2019 — forked from show0k/install_git_lfs.sh
Compile and Install git-lfs on Raspberry Pi (with golang compilation)
View install_git_lfs.sh
install_git_lfs()
{
set -e
# Get out if git-lfs is already installed
if $(git-lfs &> /dev/null); then
echo "git-lfs is already installed"
return
fi
GIT_LFS_BUILD=$HOME/.bin
@tkafka
tkafka / email od bazose.eml
Last active Apr 4, 2018
U bazose se jako odesilatel zobrazuje `jardalukas@gmail.com via bazos-www2.superhosting.cz`. U nas tam kde podvrhujeme gmail taky: `davngy@gmail.com via seznam.cz`
View email od bazose.eml
Original Message
Message ID <20171013084129.684C860593@bazos-www2.superhosting.cz>
Created at: Fri, Oct 13, 2017 at 10:41 AM (Delivered after 0 seconds)
From: jardalukas@gmail.com
To: keff85@gmail.com
Subject: Bazos.cz - odpoved na inzerat 80580804 - Fitbit Ionic - nejlepsi fitness tracker, novy
SPF: PASS with IP 88.86.119.246 Learn more
DMARC: 'FAIL' Learn more
View weathergraph promo.txt
Weathergraph shows:
🕑 Time, of course :)
🏃 Daily steps
❤️ Current heart rate
⛅️ Precise forecast from Yr.no (Dark Sky/Forecast.io coming soon!)
🌡 Hour-by-hour temperature (orange chart at the bottom)
🌧 Hour-by-hour precipitation - rain and snow (blue chart overlay)
☁️ Hour-by-hour ☁️ cloudiness (cloud cover) and ☀️ sunshine (clouds on top + sun rays)
🌤 Daily minimum and maximum (overlaid above chart)
@tkafka
tkafka / README.md
Created Jul 8, 2016
d3.v4 treemap update example
View README.md

Each pixel represents approximately one byte.

@tkafka
tkafka / apifier-get-results.sh
Last active May 29, 2016
Apifier result downloader. Usage: bash apifier-get-results <execution_id>
View apifier-get-results.sh
#!/usr/bin/env bash
if [ -z "$1" ]; then
echo "Usage: bash apifier-get-results <execution_id>"
exit 1
fi
FORMAT="csv"
EXECUTION_ID="$1"