Skip to content

Instantly share code, notes, and snippets.

View sagalbot's full-sized avatar
🏔️

Jeff Sagal sagalbot

🏔️
View GitHub Profile
@sagalbot
sagalbot / Icons.vue
Last active February 10, 2022 13:12
Super lightweight implementation of @primer/octicons as a Vue component. ex) `<icon name="alert" />`
<script>
import icons from '@pimer/octicons';
export default {
functional: true,
render(createElement, { props }) {
return Object.hasOwnProperty.apply(icons, [props.name]) ? createElement('svg', {
domProps: { innerHTML: icons[props.name].path },
attrs: { ...icons[props.name].options },
}) : false;
@sagalbot
sagalbot / Modal.js
Last active June 16, 2020 15:11
Modal Escape Hanlding
// in setup() ..
// bind listeners on mount/unmount
useEscapeKeydownWhenMounted(() => {
emit('close');
});
// bind listeners based on condition
useEscapeKeydownWhen(toRef(props, 'open'), () => {
emit('close');
<?php
namespace App\View\Components;
use Illuminate\View\Component;
class Button extends Component
{
public static $class = "py-1 px-2 font-bold uppercase rounded";
@sagalbot
sagalbot / webpack.config.js
Last active November 5, 2021 17:37
Using vue-svg-loader@beta with laravel-mix v6.
module.exports = {
output: {
assetModuleFilename: "img/[hash][ext][query]",
},
module: {
rules: [
{
test: /\.svg$/,
use: ["vue-loader", "vue-svg-loader"],
},
<template>
<Transition
v-bind="$attrs"
enter-active-class="ease-out duration-300"
enter-class="opacity-0"
enter-to-class="opacity-100"
leave-active-class="ease-in duration-200"
leave-class="opacity-100"
leave-to-class="opacity-0"
v-on="$listeners"
#!/usr/bin/env bash
set -euo pipefail
# Install system dependencies
apt-get update -qq
apt-get install -y -qq --no-install-recommends \
php-cli \
php-mbstring \
php-xml \
php-curl \