Skip to content

Instantly share code, notes, and snippets.

View michaelgatuma's full-sized avatar
:octocat:
Gittin' fun innit?

Michael Gatuma michaelgatuma

:octocat:
Gittin' fun innit?
View GitHub Profile
@michaelgatuma
michaelgatuma / gogreen-request.json
Created November 16, 2023 12:31
Go-Green New Request
{
"Regions": [
"East Midlands",
"East of England",
"London",
"North East",
"North West",
"South East",
"South West",
"West Midlands",
@michaelgatuma
michaelgatuma / gogreen-request.json
Last active November 16, 2023 12:32
Go-Green Working Request
{
"Regions": [
"East Midlands",
"East of England",
"London",
"North East",
"North West",
"South East",
"South West",
"West Midlands",
@michaelgatuma
michaelgatuma / app\Console\Kernel.php
Last active February 16, 2023 16:22
Send email alerts when laravel horizon is not active
use Laravel\Horizon\Contracts\MasterSupervisorRepository;
...
protected function isHorizonActive() : bool
{
if (! $masters = app(MasterSupervisorRepository::class)->all()) {
return false;
}
return collect($masters)->some(function ($master) {
return $master->status !== 'paused';
@michaelgatuma
michaelgatuma / DocumentProcessorController.php
Created September 16, 2022 17:22
Extract text from zipped documents using PHPWord i.e docx, doc, odt, rtf, html, pdf
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Arr;
use PhpOffice\PhpWord\Element\Section;
use PhpOffice\PhpWord\Element\Text;
use PhpOffice\PhpWord\Element\TextBreak;
use PhpOffice\PhpWord\Element\TextRun;
@michaelgatuma
michaelgatuma / index.blade.php
Created February 2, 2022 15:52
Add a reverse spin functionality to tailwindcss
<x-heroicon-s-refresh wire:target="$refresh" wire:loading.class="animate-reverse-spin" class="-ml-0.5 mr-2 h-5 w-5"/>
{{-- OR (without editing the config file just do this)--}}
<x-heroicon-s-refresh wire:target="$refresh" wire:loading.class="animate-spin transform rotate-180" class="-ml-0.5 mr-2 h-5 w-5"/>
@michaelgatuma
michaelgatuma / .htaccess
Created December 15, 2021 23:53 — forked from morcegon/.htaccess
.htaccess optimized for laravel
# Apache configuration file
# httpd.apache.org/docs/2.2/mod/quickreference.html
# Note .htaccess files are an overhead, this logic should be in your Apache
# config if possible: httpd.apache.org/docs/2.2/howto/htaccess.html
# Techniques in here adapted from all over, including:
# Kroc Camen: camendesign.com/.htaccess
# perishablepress.com/press/2006/01/10/stupid-htaccess-tricks/
# Sample .htaccess file of CMS MODx: modxcms.com
@michaelgatuma
michaelgatuma / AppServiceProvider.php
Created December 1, 2021 14:16 — forked from greenspace10/AppServiceProvider.php
Laravel, Livewire, Alpine JS Toast Notifications
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Component::macro('notify', function ($message, $title = '', $type = 'success') {
$this->dispatchBrowserEvent('notify', ['message' => $message, 'title' => $title, 'type' => $type]);
});
@michaelgatuma
michaelgatuma / gist:cb24f4fffe717982986fba08ea067882
Created November 29, 2019 14:16 — forked from 345161974/gist:63573abdf1dc9c303d6740fb29496657
Python Code for adding posts to WordPress remotely
import urllib
from wordpress_xmlrpc import Client, WordPressPost
from wordpress_xmlrpc.methods import posts
import xmlrpclib
from wordpress_xmlrpc.compat import xmlrpc_client
from wordpress_xmlrpc.methods import media, posts
import os
########################### Read Me First ###############################
'''
------------------------------------------In DETAIL--------------------------------