Skip to content

Instantly share code, notes, and snippets.

View sagalbot's full-sized avatar
🏔️

Jeff Sagal sagalbot

🏔️
View GitHub Profile
<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"
@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"],
},
<?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 / 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');
@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 / FuseFilter.vue
Created May 22, 2019 18:04
Using Fuse.js to filter items in Vue Select
<template>
<v-select :filter="fuseSearch" :options="books" :getOptionLabel="option => option.title">
<template #option="{author, title}">
{{ title }} <br>
<cite>{{ author.firstName }} {{ author.lastName }}</cite>
</template>
</v-select>
</template>
<script>
@sagalbot
sagalbot / yarn_install.sh
Last active May 31, 2020 16:03
Quick Yarn Installs on Laravel Envoyer, share `node_modules` between deployments.
cd {{ release }}
# link node_modules from last deployment
ln -s {{ project }}/node_modules
# update linked folder with latest deps
yarn install
# remove the symlink
rm node_modules
@sagalbot
sagalbot / disable-xdebug.sh
Created August 4, 2017 19:35 — forked from hacfi/disable-xdebug.sh
OS X homebrew php 7.0 enable/disable xdebug extension script
#!/bin/sh
sed -i.default "s/^zend_extension=/;zend_extension=/" /usr/local/etc/php/7.1/conf.d/ext-xdebug.ini
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.php71.plist
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.php71.plist
echo "xdebug disabled"
@sagalbot
sagalbot / livetemplate
Created June 5, 2017 18:42
PHPStorm Live Template For PHPUnit Tests
/**
* @test
*/
public function $METHOD$()
{
// $TEST$$END$
}
@sagalbot
sagalbot / Container.php
Last active April 5, 2017 19:35
A bare-bones PHP IoC container.
<?php
interface Container
{
static function bind($name, Callable $resolver);
static function make($name);
}