Skip to content

Instantly share code, notes, and snippets.

View ksherman's full-sized avatar

Kevin Sherman ksherman

View GitHub Profile
@naotone
naotone / ResponsiveImages.vue
Last active June 3, 2021 02:20
Vue component for responsive images with Sanity CMS.
<template>
<picture
v-if="devices === '3x'"
:role="role"
>
<source
v-for="(val, key, index) in sizes"
:key="index"
:media="`(min-width: ${val.media}em)`"
:srcset="`
// this is a big array of 76 items I need to split into groups of 10
const hugeArray = Array.from({ length: 76 }, (_, i) => i);
function chunkify(array, chunkSize = 10) {
// make a new array
const chunks = Array.from(
// give it however many slots are needed - in our case 8
// 1-7 with 10 items, and 8th slot will have 6
{ length: Math.ceil(array.length / chunkSize) },
// this is a map function that will fill up our slots
@composite
composite / PostCSS.targets
Last active December 21, 2023 22:00
PostCSS build tool for asp.net core or blazor
<?xml version="1.0" encoding="utf-8" ?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<NodeCli Condition=" '$(NodeCli)'=='' ">npm</NodeCli>
<PostCssRunner Condition=" '$(PostCssRunner)'=='' ">run postcss --</PostCssRunner>
<PostCssCli Condition="('$(PostCssCli)'=='' Or '$(PostCssCli)'=='true')">-o</PostCssCli>
</PropertyGroup>
<ItemGroup>
<PostCssFiles Include="$(MSBuildProjectDirectory)\**\*.pcss" Condition="!($([System.String]::Copy(%(Filename)).StartsWith('_')))" >
<?
# MIT license, do whatever you want with it
#
# This is my invoice.php page which I use to make invoices that customers want,
# with their address on it and which are easily printable. I love Stripe but
# their invoices and receipts were too wild for my customers on Remote OK
#
require_once(__DIR__.'/../vendor/autoload.php');