Skip to content

Instantly share code, notes, and snippets.

@minedun6
minedun6 / simplify.js
Created July 7, 2022 15:40
Simplify Sizes (js)
// For reference
// https://twitter.com/mattkingshott/status/1545035927831052288/photo/1
simplify(value) {
let regex = '/^-?\d+(?:\.\d{0,1})?/';
let format = (value) => value.matche(regex)[0].replace('.0', '');
// Hundred (or less)
@minedun6
minedun6 / simplify.php
Created July 7, 2022 15:36
Simplify sizes
<?php
function simplify(int | float $value) : string {
$regex = '/^-?\d+(?:\.\d{0,1})?/';
$format = function ($value) use ($regex) {
preg_match($regex, $value, $matches, PREG_OFFSET_CAPTURE);
return str_replace('.0', '', $matches[0][0]);
@minedun6
minedun6 / segmentcontrol.vue
Created June 10, 2022 16:01 — forked from jamiecarter7/segmentcontrol.vue
iOS 14 Segmented Control with Vue and TailwindCSS - Complete Template (3 Segments)
<template>
<div class="bg-gray-200 rounded-lg" style="padding: 2px;">
<div class="relative flex items-center">
<!-- tab dividers -->
<div class="absolute w-full">
<div class="w-1/3 flex justify-between m-auto">
<div class="h-3 w-px bg-gray-400 rounded-full opacity-0 transition-opacity duration-100 ease-in-out" :class="{ 'opacity-100': selectedTab === 'segment3'}"></div>
<div class="h-3 w-px bg-gray-400 rounded-full opacity-0 transition-opacity duration-100 ease-in-out" :class="{ 'opacity-100': selectedTab === 'segment1'}"></div>
</div>
@minedun6
minedun6 / .php-cs-fixer.php
Created April 26, 2022 08:56 — forked from laravel-shift/.php-cs-fixer.php
PHP CS Fixer - Laravel Coding Style Ruleset
<?php
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
$rules = [
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => [
'default' => 'single_space',
@minedun6
minedun6 / useCursor.ts
Created February 1, 2022 08:15 — forked from steveruizok/useCursor.ts
Generate a rotated cursor based on a cursor and rotation.
import { GeomUtils, TLCursor } from '@tldraw/core'
import * as React from 'react'
function getCursorCss(svg: string, r: number, f = false) {
return (
`url("data:image/svg+xml,<svg height='32' width='32' viewBox='0 0 35 35' xmlns='http://www.w3.org/2000/svg'><g fill='none' style='transform-origin:center center' transform='rotate(${r})${
f ? ` scale(-1,-1) translate(0, -32)` : ''
}'>` +
svg.replaceAll(`"`, `'`) +
'</g></svg>") 16 16, pointer'
@minedun6
minedun6 / microsoft_graph_api_php_jwt.md
Created January 27, 2022 08:12 — forked from fideloper/microsoft_graph_api_php_jwt.md
Microsoft Graph API - oAuth apps with PHP and JWT certification authentication

Microsoft Graph API - oAuth apps with PHP and JWT certification authentication

If you've ever wanted to create an oAuth style application with Microsoft, you might have felt this pain before.

In true Enterprise Microsoft Fashion™, there's a lot going on.

This will be a bit long because of that. I hope I haven't missed anything (but I'm sure I have)!

We'll be using PHP (Laravel in my case).

document.addEventListener('alpine:init', () => {
Alpine.store('breakpoint', {
listeners: {},
init() {
const breakpoints = {
sm: 640,
md: 768,
lg: 1024,
xl: 1280,
<?
//
// AUTO KEYWORD-BASED FOLLOWER CURATION BOT (by @levelsio)
//
// File: twitterFollowerCuratorBot.php
//
// Created: May 2021
// License: MIT
//
@minedun6
minedun6 / PDFViewer.php
Created May 26, 2021 10:15 — forked from mccarlosen/PDFViewer.php
PDFViewer Livewire Component
<?php
namespace App\Http\Livewire\Components;
use Livewire\Component;
class PdfViewer extends Component
{
public $openModal = false;
public $titleModal = "PDF Viewer";
<?php
//import db from original server to local one...
/**
* Instructions:
* 1. Install this package: https://laravelcollective.com/docs/5.3/ssh
* 2. Add those to your .env file and fill up the values:
ORIGINAL_SERVER_SSH_ADDRESS=
ORIGINAL_SERVER_SSH_USERNAME=