Skip to content

Instantly share code, notes, and snippets.

@benjclark
benjclark / gist:1d1318e08cba8c95c4d429d5dee275dc
Created April 26, 2022 19:06
css for making the scrollbar always visible on MacOS
::-webkit-scrollbar {
-webkit-appearance: none;
width: 7px;
}
::-webkit-scrollbar-thumb {
border-radius: 4px;
background-color: rgba(0, 0, 0, .5);
box-shadow: 0 0 1px rgba(255, 255, 255, .5);
}
<div class="bens-star">
<svg xmlns="http://www.w3.org/2000/svg" version="1.0" viewBox="0 0 1004 954"><path d="M449 163.2c-28.8 88.7-55.2 170.2-58.7 181l-6.4 19.8H193c-105.1 0-191 .3-191 .7 0 .5 69.4 51.2 154.1 112.7 145.7 105.8 154.1 112 153.5 114.5-.3 1.9-112.4 348.1-116.1 358.8-.2.7 0 1.3.4 1.3.5 0 69.9-50.2 154.2-111.5C432.5 779.2 501.7 729 502 729c.3 0 69.5 50.2 153.9 111.5C740.2 901.8 809.6 952 810.1 952c.4 0 .6-.6.4-1.3-3.7-10.7-115.8-356.9-116.1-358.8-.6-2.5 7.8-8.7 153.5-114.5 84.7-61.5 154.1-112.2 154.1-112.7 0-.4-85.9-.7-191-.7H620.1l-6.4-19.8C572.6 216.7 502.5 2 502 2c-.4 0-24.2 72.6-53 161.2zm-44.2 261.7c15.8 7.1 20.3 27 8.9 38.9-1.8 1.9-4.5 4.1-6.2 5l-3 1.5 3.1.9c6.3 1.6 12.7 6.9 15.8 13.2 2.7 5.1 3 6.8 3 14.6s-.3 9.4-3 14.6c-3.7 7.2-10.4 12.7-19.3 15.4-5.4 1.7-9.2 2-26.7 2H357V423.1l2.3-.4c1.2-.3 10.8-.4 21.2-.3 17.6.1 19.4.3 24.3 2.5zm139 16.4.3 10.7H565v12h-21.1l.3 24.4c.3 24.2.3 24.5 2.7 27 3.9 4.1 8 5 15.1 3.2 3.4-.9 6.3-1.6 6.5-1.6.1 0 .6 2.1 1 4.7.3 2.7.9 5.8 1.1 6.9.5 2-.1 2.2-7.1 3.3
function getDtDdPairs() {
const dts = document.querySelectorAll('dt');
const dds = document.querySelectorAll('dd');
const pairs = [];
for (let i = 0; i < dts.length; i++) {
pairs.push([dts[i], dds[i]]);
}
return pairs;
}
@benjclark
benjclark / issue.scss
Last active November 4, 2021 11:56
global meta issue with spacing function and dart sass
$context--spacing: (0, 2, 4, 8, 16, 24, 32, 48, 64);
$context--keyline-border-color: #ccc;
@function spacing($keys...) {
@if length($context--spacing) == 0 {
@error 'No values found in $context--spacing.';
}
@if length($keys) > 4 {
@error 'spacing() accepts a maximum of 4 arguments.';
const nameEl = document.getElementById('name');
const button = document.getElementById('generate-button');
const names = [
["Grob", "Skar", "Gut", "Ghul", "Grog", "Big", "Smash", "Gob", "Bug", "Bog", "Ghaz", "Doc", "Rip"], //first syllable
["face", "gob", "nob", "kill", "teef", "toof", "khul", "glob", "glut", "bag"], //second syllable
["Ead", "Big", "Maw", "Teef", "Thrak", "Doc", "Bog", "Bog", "Smak", "Wak", "Crak", "Lad", "Bom"], //third syllable
["smasha", "stitcha", "crusha", "sneaka", "fighta", "rippa", "shoota", "twista", "wakka", "lobba"]]; //fourth syllable
function getRandomIndexFromArray(array) {
<body>
<!--Start-->
<!--This is an example of a snippet of html that you have in a file that Intercooler will ajax in some time after page has fully loaded-->
<!--All you need to do is add the two data attributes as seen below, 1 on the element wrapping the clickable html and 1 on the element wrapping the word that should toggle-->
<!--You only need to define the below script with each snippet (file) rather than duplicating all the show hide logic each time-->
<script>
Intercooler.ready(function(rootElement) {
window.showHide(rootElement.find('[data-toggle-show-hide]'));
});
</script>
<body>
<div>
<a href="#data_image" class="small align-top mr-4 metadata-link" data-toggle="collapse">
<span class="fas fa-table"></span>
<!--Put the below data attribute on every word (wrapped in span) you want to toggle "Show" and "Hide"-->
<span data-toggle-show-hide><span data-toggle-show-hide-word>Show</span> metadata</span>
</a>
</div>
<style>
.specimen-choice-card {
width: 250px;
line-height: 1.2;
}
.specimen-choice-card:not(:first-child) {
margin-top: 0.5rem;
}
.specimen-choice-card__container {
justify-content: center;
@benjclark
benjclark / gist:e989373008ce935ef5509f5f61a3637e
Created October 28, 2020 14:09
colorspace css refactor
<style>
#color_analysis_content .card {
height: 300px;
justify-content: space-between;
}
</style>
<div id="color_analysis_content" ic-get-from="/data/r_analysis/recolor/ICDB000060/rondoni_HT_dors_comp.tif/" ic-trigger-on="load" class="mt-2" ic-src="/data/r_analysis/recolor/ICDB000060/rondoni_HT_dors_comp.tif/" ic-deps="ignore" ic-id="2">
<div class="row">
<!-- Original image -->
<div class="col-12 col-sm-6 col-lg-2">
t.forEach((function(e) {
var t = e.getAttribute("ms-field") || e.getAttribute("data-ms-member");
if ("email" !== t && "password" !== t) {
t = t.replace(/[^a-zA-Z\s]+/g, "-").toLowerCase();
var r = e.getAttribute("type");
if ("checkbox" === r)
o[t] = e.checked;
else if ("radio" === r) {
var n = e.getAttribute("name");
if (!i[n]) {