Skip to content

Instantly share code, notes, and snippets.

View geekish's full-sized avatar

Hannah Chartier geekish

View GitHub Profile
@danecando
danecando / tailwind-color-vars.js
Created September 5, 2022 13:09
A simple plugin that exposes all tailwind colors as css variables on :root
function ({ addBase, theme }) {
function extractColorVars(colorObj, colorGroup = '') {
return Object.keys(colorObj).reduce((vars, colorKey) => {
const value = colorObj[colorKey];
const newVars =
typeof value === 'string'
? { [`--color${colorGroup}-${colorKey}`]: value }
: extractColorVars(value, `-${colorKey}`);
@awcodes
awcodes / FilamentServiceProvider.php
Last active September 27, 2023 04:26
Laravel, Vite, SSL Valet with Multiple Tailwind configs
<?php
namespace App\Providers;
use Filament\Facades\Filament;
use Illuminate\Foundation\Vite;
use Illuminate\Support\ServiceProvider;
class FilamentServiceProvider extends ServiceProvider
{
@sindresorhus
sindresorhus / esm-package.md
Last active July 24, 2024 08:34
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@jasonvarga
jasonvarga / console.php
Created August 17, 2020 20:51
Statamic Beta 45 Fields Migration Helper
<?php // copy everything after this line
use Illuminate\Support\Facades\Artisan;
use Statamic\Facades\File;
use Statamic\Facades\YAML;
class MigrateBetaFortyFive
{
protected $console;
@jasonvarga
jasonvarga / console.php
Last active July 31, 2022 18:01
Statamic Beta 38 Blueprints Migration Helper
<?php // copy everything after this line
use Illuminate\Support\Facades\Artisan;
use Statamic\Facades\AssetContainer;
use Statamic\Facades\Blueprint;
use Statamic\Facades\Collection;
use Statamic\Facades\File;
use Statamic\Facades\Form;
use Statamic\Facades\GlobalSet;
use Statamic\Facades\Taxonomy;
#!/usr/bin/env node
const { writeFileSync, readFileSync, unlinkSync } = require('fs')
const package = require('./package.json')
const packageLock = require('./package-lock.json')
const TEMPLATE_GITHUB_REPOSITORY = 'org/template'
const { GITHUB_REPOSITORY } = process.env
@KevinBatdorf
KevinBatdorf / add-alpine-js-to-tailwind-ui.js
Last active May 7, 2024 18:51
Auto copy the Alpine code from Tailwind UI's copy button
// ==UserScript==
// @name Add AlpineJs to Tailwind UI
// @namespace http://tampermonkey.net/
// @version 3.0
// @description Add Alpine JS code to Tailwind Ui copy/paste
// @author https://gist.github.com/KevinBatdorf/8bd5f808fff6a59e100dfa08a7431822
// @match https://tailwindui.com/components/*
// @grant none
// ==/UserScript==
@herpaderpaldent
herpaderpaldent / Pagination.vue
Created January 11, 2020 08:51
LaravelCollectionPaginationComponent
<template>
<nav aria-label="pagination">
<ul class="pagination justify-content-end">
<li :class="['page-item', collection.meta.current_page <= 1 ? 'disabled' : '']">
<inertia-link class="page-link" :href="collection.links.first" tabindex="-2">First</inertia-link>
</li>
<li :class="['page-item', collection.meta.current_page <= 1 ? 'disabled' : '']">
<inertia-link class="page-link" :href="collection.links.prev" tabindex="-1">Previous</inertia-link>
</li>
@jasonvarga
jasonvarga / statamic2-vs-3.md
Last active March 5, 2021 18:53
Statamic 2 vs 3

Tests run on a 2013 Macbook Pro with 2.8GHz Intel Core i7, 16 GB 1600 MHz DDR3 using Laravel Valet.

Statamic 2 with 5000 entries

On a template listing 10 posts sorted by date.

Concurrency 1

@calebporzio
calebporzio / HiddenInput.vue
Created May 2, 2018 14:47
Little Vue component for turning JSON into native HTML for inputs
<script>
import _ from 'lodash'
export default {
props: [ 'name', 'value' ],
methods: {
flatInputsFromDeepJson(item, key, h) {
if (typeof item === 'object') {
return _.flatMapDeep(item, (value, newKey) => {