Skip to content

Instantly share code, notes, and snippets.

@sasin91
sasin91 / Country.php
Created June 17, 2022 07:49
extensible Enum with country names, alpha2, alpha3
<?php
namespace App\Enums;
use ArchTech\Enums\From;
use function array_flip;
use ArchTech\Enums\Values;
use ArchTech\Enums\Options;
use Illuminate\Support\Str;
@sasin91
sasin91 / MuxLiveViewers.vue
Created October 25, 2022 08:24
ZomeTV Broadcast live stats
<script lang="ts">
export default {
props: {
jwtToken: String,
},
data() {
return {
intervalId: undefined,
@sasin91
sasin91 / CreateMuxJWTToken.php
Created October 25, 2022 08:32
Action class that's called for creating Broadcast.mux_stats_jwt_token
<?php
namespace App\Actions;
use App\Enums\JWTTokenType;
use App\Models\Broadcast;
use App\Services\MuxApiClient;
use App\Values\MuxJWTToken;
use MuxPhp\ApiException;
@sasin91
sasin91 / getCalleeFromStackTrace.js
Created February 12, 2024 13:13
getCalleeFromStackTrace.js
export const getCalleeFromStackTrace = () => {
const e = new Error();
const frame = e.stack.split(`\n`)[2]; // change to 3 for grandparent func
// const lineNumber = frame.split(`:`).reverse()[1];
// const functionName = frame.split(` `)[5];
const regex = /(\S+)\s+\(([^:]+):(\d+):(\d+)\)/;
const match = frame.trim().match(regex);
@sasin91
sasin91 / lua
Created June 14, 2024 15:55
init.lua
--[[
=====================================================================
==================== READ THIS BEFORE CONTINUING ====================
=====================================================================
======== .-----. ========
======== .----------------------. | === | ========
======== |.-""""""""""""""""""-.| |-----| ========
======== || || | === | ========
======== || KICKSTART.NVIM || |-----| ========
@sasin91
sasin91 / PriceMatrix.php
Created December 11, 2024 15:11
PriceMatrix.php
<?php
namespace App;
use App\Enums\Discount;
use Brick\Money\Money;
use Illuminate\Contracts\Support\Arrayable;
use InvalidArgumentException;
use WeakMap;