Skip to content

Instantly share code, notes, and snippets.

View breadthe's full-sized avatar

breadthe

View GitHub Profile
https://developers.strava.com/
https://developers.strava.com/docs/webhooks/
https://developers.strava.com/docs/webhookexample/
@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;
@breadthe
breadthe / version.blade.php
Last active December 28, 2022 10:31
Display app git tag & commit hash in a Laravel app
// resources/views/app/version.blade.php
<div>
<span>{{ config('version.string') }}</span>
<span>&mdsh;</span>
<span>{{ config('app.env') }}</span>
<span>&mdash;</span>
<span>{{ 'Laravel ' . app()->version() }}</span>
<span>&mdash;</span>
<span>{{ app()->getLocale() }}</span>
@breadthe
breadthe / formatBytes.php
Created November 25, 2021 18:14
Format bytes to human readable (KB/MB/GB)
<?php
/**
* Put this in bootstrap/helpers.php
* Add "files" key in composer.json > autoload: "files": ["bootstrap/helpers.php"]
* @see https://stackoverflow.com/questions/2510434/format-bytes-to-kilobytes-megabytes-gigabytes
*/
function formatBytes(int $bytes, $precision = 2)
{
$units = ['B', 'KB', 'MB', 'GB', 'TB'];
@breadthe
breadthe / Log.php
Created April 2, 2022 21:56
Barebones PHP error logging class
<?php
// src/Log.php
namespace App;
/**
* Barebones error logging class
*
* Location: <project root>/src/Log.php
*
* Usage:
@breadthe
breadthe / app.js
Last active April 11, 2022 12:58
Alpine.js + Blade copy to clipboard button
<!--
resources/js/app.js
Put this code at the bottom of `app.js`
OR
Put it in a `clipboard.js` file and import it in `app.js` with:
require('./clipboard');
-->
window.initClipboard = () => {
@breadthe
breadthe / sd.sh
Created September 2, 2022 17:56
Stable Diffusion prompt script
#!/bin/bash
echo -n "Enter a prompt: "
read prompt
echo -n "Steps (default 10): "
read steps
if [[ -z "$steps" ]]; then
steps=10
@breadthe
breadthe / txt2img.py
Last active July 29, 2023 20:00
Save image generation parameters into textfile along with the generated image + disable safety check
import argparse, os, sys, glob
import cv2
import torch
import numpy as np
from omegaconf import OmegaConf
from PIL import Image
from tqdm import tqdm, trange
from imwatermark import WatermarkEncoder
from itertools import islice
from einops import rearrange
@breadthe
breadthe / Bytes.php
Created January 10, 2023 16:34 — forked from inxilpro/Bytes.php
<?php
namespace App\Support;
use InvalidArgumentException;
class Bytes
{
// Most modern systems use base-1000 rather than base-1024 for file size now
protected const BASE = 1000;
@breadthe
breadthe / seismic-update.json
Last active February 14, 2023 08:34
Seismic update.json
{
"version": "1.0.2",
"notes": "1.0.2 update",
"pub_date": "2023-02-13T21:42:04.140Z",
"platforms": {
"darwin-x86_64": {
"signature": "",
"url": "https://github.com/breadthe/seismic/releases/download/v1.0.2/seismic.app.tar.gz"
},
"darwin-aarch64": {