Skip to content

Instantly share code, notes, and snippets.

View breadthe's full-sized avatar

breadthe

View GitHub Profile
@breadthe
breadthe / _virtual-select.scss
Created November 14, 2021 14:21 — forked from ousid/_virtual-select.scss
Laravel Searchable Dropdown Component
// custom style using sass & tailwindcss
.vscomp-ele {
max-width: 100% !important;
.vscomp-toggle-button {
@apply mt-1 border-gray-300 transition block w-full duration-150 rounded-md shadow-inner bg-gray-100 py-3;
&:focus {
@apply border border-info ring-info ring-opacity-25;
https://developers.strava.com/
https://developers.strava.com/docs/webhooks/
https://developers.strava.com/docs/webhookexample/
// @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
const plugin = require('tailwindcss/plugin');
const production = !process.env.ROLLUP_WATCH;
module.exports = {
purge: {
enabled: production,
content: [
'./src/**/*.html',
'./src/**/*.svelte',
],
@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(`
@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 / 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 / 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 / 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 / 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';