Skip to content

Instantly share code, notes, and snippets.

View breadthe's full-sized avatar

breadthe

View GitHub Profile
@breadthe
breadthe / forge.sh
Created November 22, 2019 05:50
Laravel Forge Setup Script
#
# REQUIRES:
# - server (the forge server instance)
# - event (the forge event instance)
# - sudo_password (random password for sudo)
# - db_password (random password for database user)
# - callback (the callback URL)
#
@breadthe
breadthe / SymfonyColorsDemo.php
Created February 10, 2020 23:40
A Laravel console command that lists all the default Symfony output formatter styles
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
class SymfonyColorsDemo extends Command
{
protected $signature = 'demo:symfony-colors';
@breadthe
breadthe / CustomColorAsciiLogoDemo.php
Created February 10, 2020 23:43
A Laravel console command that generates a colored Ghostbusters logo
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class CustomColorAsciiLogoDemo extends Command
{
protected $signature = 'demo:ascii-logo';
@breadthe
breadthe / SignInController.php
Created September 2, 2020 03:57 — forked from Gummibeer/SignInController.php
Laravel ThrottlesRequests trait
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Concerns\ThrottlesRequests;
use App\Http\Requests\Auth\SignInRequest;
use App\Http\Requests\Auth\SignUpRequest;
use App\Models\User;
use Illuminate\Auth\Events\Registered;
use Illuminate\Http\RedirectResponse;
@breadthe
breadthe / StoreFetch.svelte
Last active January 6, 2021 14:23
Svelte Summit 2020 | Tim Raderschad | Modern Fetch in Svelte using Stores
<script>
import getData from './fetcher.js';
const response = getData(url);
{#await $response}
<Spinner />
{:then data}
<code {data}>
{:catch}
@breadthe
breadthe / CustomTransition.svelte
Last active January 6, 2021 14:22
Svelte Summit 2020 | Tan Li Hau | Demystifying Svelte Transitions
<!-- Based on Demystifying Svelte Transitions (Tan Li Hau) Svelte Summit 2020 -->
<script>
function customTransition(node) {
let originalText = node.textContent;
return {
delay: 0,
duration: 1000,
css: (t, u) => {
if (t < 0.4) return `font-weight: 500; color: maroon;`;
@breadthe
breadthe / app%Http%Livewire%Stats%DistanceByYear.php
Last active January 22, 2024 06:26
Laravel Livewire + Apexcharts
<?php
namespace App\Http\Livewire\Stats;
use Illuminate\Support\Facades\DB;
use Livewire\Component;
class DistanceByYear extends Component
{
public $chartId;
@breadthe
breadthe / Slack avatar-less sidebar.md
Created November 13, 2020 15:30 — forked from joshuat/Slack avatar-less sidebar.md
Remove the avatars from your slack sidebar
  1. Message yourself /slackdevtools
  2. In the DevTools console:
function addStyle (styleString) {
  const style = document.createElement('style');
  style.textContent = styleString;
  document.head.append(style);
}

addStyle(`
const plugin = require('tailwindcss/plugin');
const production = !process.env.ROLLUP_WATCH;
module.exports = {
purge: {
enabled: production,
content: [
'./src/**/*.html',
'./src/**/*.svelte',
],
// @see https://stackoverflow.com/a/8809472
export function uuid() { // Public Domain/MIT
var d = new Date().getTime();//Timestamp
var d2 = (performance && performance.now && (performance.now() * 1000)) || 0;//Time in microseconds since page-load or 0 if unsupported
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
var r = Math.random() * 16;//random number between 0 and 16
if (d > 0) {//Use timestamp until depleted
r = (d + r) % 16 | 0;
d = Math.floor(d / 16);
} else {//Use microseconds since page-load if supported