Skip to content

Instantly share code, notes, and snippets.

View andybeesee's full-sized avatar

Andy BeeSee andybeesee

View GitHub Profile
@andybeesee
andybeesee / choices.scss
Created April 5, 2022 14:24
Bootstrap 5 choices.js styling, with Stimulus controller
$choices-font-size-lg: $input-font-size-lg;
$choices-font-size-md: $input-font-size;
$choices-font-size-sm: $input-font-size-sm;
$choices-guttering: $spacer;
$choices-border-radius: 0;
$choices-border-radius-item: 0;
@if $enable-rounded {
$choices-border-radius: $input-border-radius;
@andybeesee
andybeesee / CreateFontawesomeIconArray.php
Created August 4, 2020 09:18
Laravel Fontawesome SVG command, turns SVG files in to a set of arrays, that you can include from your app
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
/**
* Class CreateFontawesomeIconArray
* @package App\Console\Commands
*
@andybeesee
andybeesee / properties-overlay.js
Last active December 11, 2018 14:31
SOGO Integrator properties-overlay.js (see lines 160-167
/* -*- Mode: java; tab-width: 2; c-tab-always-indent: t; indent-tabs-mode: t; c-basic-offset: 2 -*- */
function jsInclude(files, target) {
let loader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
for (let i = 0; i < files.length; i++) {
try {
loader.loadSubScript(files[i], target);
}
catch(e) {
@andybeesee
andybeesee / DefaultQuery.php
Last active November 5, 2017 12:44
Slightly more advanced eager loading example for Folkloreatelier Laravel GraphQL package
<?php
/*
Better eager loading example for GraphQL package
https://github.com/Folkloreatelier/laravel-graphql/blob/master/docs/advanced.md#eager-loading-relationships
Given a GraphQL query like....
{
document {
id,
<?php
// Array average method for use within Laravel framework
// simple example usage:
// $arr = [1,2,3]
// $avg = array_average($arr) //outputs '2'
//
// Associative array usage, find average comments per user
// $arr = [ ['user_id' => 1, 'total_comments' => 5], ['user_id' => 2, 'total_comments ' => 9] ]
// $avg = array_average($arr, 'total_comments') //outputs '7'
@andybeesee
andybeesee / ConvertTimes.php
Created September 19, 2016 16:57
Laravel - eloquent model trait for converting timezone automagically
<?php namespace App\Traits;
use Carbon\Carbon;
Trait ConvertTimes
{
/**
* Return a timestamp as DateTime object.
*
* @param mixed $value