Skip to content

Instantly share code, notes, and snippets.

View iDevelopThings's full-sized avatar

Sam Parton iDevelopThings

View GitHub Profile
@iDevelopThings
iDevelopThings / GizmoExtension.cs
Created February 12, 2023 03:24
GizmoTextPls
using UnityEditor;
using UnityEngine;
namespace Game.Util.Extensions
{
public class GizmoExtension
{
public static void DrawString(string text, Vector3 worldPosition, Color textColor, Vector2 anchor, float textSize = 15f)
{
@iDevelopThings
iDevelopThings / GetHashIdCommand.php
Last active January 25, 2023 11:08
HashIds in laravel
<?php
namespace App\Console\Commands;
use App\Support\HashIds;
use Illuminate\Console\Command;
use Illuminate\Contracts\Container\BindingResolutionException;
use Spatie\ModelInfo\ModelFinder;
use Str;
class GetHashIdCommand extends Command
@iDevelopThings
iDevelopThings / annotation_example.php
Created January 25, 2023 07:31
Get php doc block annotations data(could be used alongside reflection to get return types etc)
<?php
class SomethingElse
{
}
class Something
{
@iDevelopThings
iDevelopThings / extract.js
Created September 15, 2021 15:47
extract colors from vscode theme
// Slapped this together real-quick for some one :D
const colors = [];
const themeData = JSON.parse('{"name":"Aurora X","type":"dark","colors":{"icon.foreground":"#576daf","activityBar.background":"#07090F","activityBar.foreground":"#86A5FF","activityBar.inactiveForeground":"#576dafc5","activityBarBadge.background":"#86A5FF","activityBarBadge.foreground":"#07090F","badge.background":"#86A5FF","badge.foreground":"#07090F","breadcrumb.activeSelectionForeground":"#86A5FF","breadcrumb.focusForeground":"#576daf","breadcrumb.foreground":"#576dafa6","breadcrumbPicker.background":"#07090F","button.background":"#86A5FF","button.foreground":"#07090F","button.hoverBackground":"#A8BEFF","diffEditor.insertedTextBackground":"#64d3892c","diffEditor.removedTextBackground":"#dd50742c","diffEditor.diagonalFill":"#15182B","descriptionForeground":"#576daf79","dropdown.background":"#15182B","dropdown.foreground":"#c7d5ff99","editor.background":"#07090F","editorCodeLens.foreground":"#262E47","editorGroup.background":"#07090F"
@iDevelopThings
iDevelopThings / ZiggyMixExtension.js
Created June 28, 2021 12:56
Generate typescript definitions for ziggy-js so you get auto completion for the route() helper
const mix = require('laravel-mix');
const {exec} = require('child_process');
mix.extend('ziggy', new class {
register(config = {})
{
this.watch = config.watch ?? ['routes/**/*.php'];
this.enabled = config.enabled ?? !Mix.inProduction();
}
@iDevelopThings
iDevelopThings / golang structs
Created May 30, 2021 02:14
Example of passing client reference/"class" in golang
type ClientLogic struct {
Client *twitchgo.Client
}
func Main() {
clientLogic := ClientLogic{
Client: twitchClient,
}
@iDevelopThings
iDevelopThings / Pagination.vue
Created February 23, 2021 13:04
xLaravel/vue/Inertia paginator
<template>
<div class="bg-white rounded shadow flex items-center justify-center mt-6 p-4"
v-if="pagination.total > pagination.per_page">
<ul class=" flex flex-wrap gap-1">
<li v-if="pagination.current_page > 1">
<a class="bg-white block px-4 py-3 text-sm border rounded hover:bg-gray-100"
href="javascript:void(0)"
aria-label="Previous"
v-on:click.prevent="changePage(pagination.current_page - 1)">
<span aria-hidden="true">«</span>
@iDevelopThings
iDevelopThings / SomeState.js
Created January 24, 2021 10:10
VueJS Observable State
import Vue from 'vue';
class SomeState {
constructor()
{
this.state = Vue.observable({});
}
@iDevelopThings
iDevelopThings / YoutubeUrl.php
Last active November 29, 2020 15:47
PHP/Laravel, get youtube video id + start time
<?php
namespace App\Services\YouTube;
use Str;
class YoutubeUrl
{
private string $url;
@iDevelopThings
iDevelopThings / DragDrop.vue
Last active August 15, 2023 21:45
Handles drag and drop file upload in VueJS
<!-- USAGE -->
<drag-drop-file-upload ref="dragDropFileUpload" @handleInput="changeImage"></drag-drop-file-upload>
//Handle image change/upload etc
changeImage({file, filePreview}) {
console.log({file, filePreview});
},
//Clear files added/dropped onto component?