Skip to content

Instantly share code, notes, and snippets.

@Lelectrolux
Lelectrolux / bootstrap-app.php
Created July 16, 2025 14:26
Add Laravel exception context
<?php
//
$exceptions->context(function (Throwable $e, array $context) {
try {
if (app()->runningUnitTests()) {
$context['isRunningTest'] ??= true;
}
if (app()->runningInConsole()) {
$context['runningIn'] ??= 'console';
@Lelectrolux
Lelectrolux / index.html
Created March 26, 2022 21:54
Alpine.js + Tailwind CSS prototype starter
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Prototype</title>
<!-- https://tailwindcss.com/docs/installation -->
<script src="https://cdn.tailwindcss.com" defer></script>
@Lelectrolux
Lelectrolux / responsive-menu.html
Created January 6, 2021 18:07 — forked from Akryum/responsive-menu.html
Tailwind negate responsive breakpoints
<div class="flex !md:flex-col items-center !md:space-y-6 md:space-x-6">
<button>Menu button 1</button>
<button>Menu button 2</button>
<button>Menu button 3</button>
</div>
.wrapper {
--gap: 32px;
display: grid;
grid-column-gap: var(--gap);
grid-template-columns: 1fr min(65ch, calc(100% - 2 * var(--gap))) 1fr;
}
.wrapper > * {
grid-column: 2;
}
@Lelectrolux
Lelectrolux / webpack.mix.js
Created September 29, 2020 13:41 — forked from thecrypticace/webpack.mix.js
Mix + custom API for separate builds
const mix = require("laravel-mix")
mix.site = (id, callback) => {
if (!process.env.SITE || process.env.SITE === id) {
return callback()
}
};
mix.site('admin', () => {
mix.js("resources/js/admin/app.js", "public/js/admin.js")
export default {
render () {},
mounted () {
Object.keys(this.$listeners)
.foreach(event => {
window.addEventListener(event, this.$listeners[event])
})
},
@Lelectrolux
Lelectrolux / README.md
Last active January 9, 2020 08:13
Basic requiredwith support in HTML/JavaScript
<form>
  <input name="foo" id="foo">
  <input name="bar" id="bar" requiredwith="foo,baz">
  <input name="baz" id="baz">
</form>

Simply add a comma separated list of ids of inputs.

Hooks into native required support, so as is, it won't display a more specialised error message than the default required one.

@Lelectrolux
Lelectrolux / List.vue
Created December 17, 2019 15:07 — forked from Akryum/List.vue
Vue - onScrollBottom composable function
<script>
import { ref } from '@vue/composition-api'
import { onScrollBottom } from '@/scroll'
export default {
setup () {
function loadMore () {
// ...
}
<script>
export default {
render() {
return this.$scopedSlots.default({
update: this.update,
data: this.$data.data
})
},
props: ['initialData', 'created', 'mounted'],
data() {
@Lelectrolux
Lelectrolux / README.md
Last active January 24, 2025 07:27
Tailwindcss breakpoint inspector, initial idea from https://gist.github.com/jonsugar/6bce22bd7d3673294caad36046c2b7cb

Tailwindcss plugin that adds a small box in the lower right corner of the screen showing the current breakpoint

Uses a position: fixed after css pseudo element on the body, so no extra markeup, and it get the breakpoint list by itself.