Skip to content

Instantly share code, notes, and snippets.

View timkelty's full-sized avatar

Tim Kelty timkelty

View GitHub Profile
#!/bin/bash
git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME $@
<?php
namespace modules\appmodule\controllers;
use Craft;
use craft\elements\Asset;
use craft\web\Controller;
use spicyweb\embeddedassets\Plugin as EmbeddedAssets;
use yii\web\Response;
<?php
function extractCssFiles(array $manifest, string $manifestKey): array
{
$entry = $manifest[$manifestKey] ?? null;
if (!$entry) {
return [];
}
$filteredBody = array_filter(Craft::$app->getRequest()->getBodyParams());
Craft::$app->getRequest()->setBodyParams($filteredBody);
# Allow caching for anything but private
if (!beresp.http.cache-control ~ "(?i)private") {
unset beresp.http.set-cookie;
}
<?php
// Type juggle keys as string or array
// -------------------------------------
public function getFoo(mixed $keyOrKeys)
{
}
// Variable args
import {hot} from 'react-hot-loader/root';
import React, {useState} from 'react';
import Uppy from '@uppy/core';
import XHRUpload from '@uppy/xhr-upload';
import {DragDrop, StatusBar, ProgressBar} from '@uppy/react';
import '@uppy/core/dist/style.css';
import '@uppy/status-bar/dist/style.css';
import '@uppy/progress-bar/dist/style.css';
import '@uppy/drag-drop/dist/style.css';
import {ReactSortable} from 'react-sortablejs';
@timkelty
timkelty / ElementTransformer.php
Last active November 23, 2020 19:55
Scout Transformers
<?php
namespace modules\appmodule\transformers;
use craft\base\ElementInterface;
use League\Fractal\TransformerAbstract;
use modules\appmodule\AppModule;
use Tightenco\Collect\Support\Collection;
class ElementTransformer extends TransformerAbstract
/* See: node_modules/@tailwindcss/typography/dist/typography.css */
@layer components {
@responsive {
.prose {
color: theme("colors.gray.copy");
max-width: 65ch;
}
.prose [class~="lead"] {
color: theme("colors.gray.copy");
const defaultTheme = require('tailwindcss/defaultTheme')
const prefixedColors = Object.fromEntries(Object.entries(defaultTheme.colors).map(([k, v]) => [`tw-${k}`, v]));
module.exports = {
theme: {
extend: {
colors: {
...prefixedColors,
red: '#ff0000',
// your colors here…