Skip to content

Instantly share code, notes, and snippets.

View hotmeteor's full-sized avatar
👾

Adam Campbell hotmeteor

👾
View GitHub Profile
@hotmeteor
hotmeteor / sic_to_naics.php
Created February 3, 2024 14:12
SIC to NAICS code in PHP array format
<?php
// As found here: https://www.naics.com/sic-naics-crosswalk-search-results/
return [
[
'sic_code' => '0111',
'sic_description' => 'Wheat',
'naics_code' => '111140',
'naics_description' => 'Wheat Farming',
@hotmeteor
hotmeteor / sic_codes.php
Created February 3, 2024 13:27
SIC codes as PHP array
<?php
// As listed here: https://www.sec.gov/corpfin/division-of-corporation-finance-standard-industrial-classification-sic-code-list
return [
[
'code' => 100,
'office' => 'Industrial Applications and Services',
'industry' => 'AGRICULTURAL PRODUCTION-CROPS',
],
@hotmeteor
hotmeteor / ApaTitle.php
Created January 3, 2024 22:16
Laravel APA title case macro
<?php
namespace App\Providers\Macros;
class ApaTitle
{
public function __invoke()
{
return function ($string) {
// Define minor words to be lowercase
@hotmeteor
hotmeteor / Users.v1.json
Last active November 2, 2020 23:40
Spectator example
{
"openapi": "3.0.0",
"info": {
"title": "Users.v1",
"version": "1.0"
},
"servers": [
{
"url": "http://localhost:3000"
}
<?php
$results = DB::table('users')
->select('users.id', 'users.first_name', 'users.last_name', 'users.email')
->select('latest_account.name', 'latest_account.city')
->joinLateral(function($query) {
$query->select('accounts.name', 'accounts.city')
->from('accounts')
->whereColumn('accounts.user_id', 'users.id')
->orderByDesc('accounts.id')

Keybase proof

I hereby claim:

  • I am hotmeteor on github.
  • I am adamspur (https://keybase.io/adamspur) on keybase.
  • I have a public key ASCITLrhXiOL5OmmPvkyMEAGsDiJtjy4uwAne1i7iBnHcQo

To claim this, I am signing this object:

@hotmeteor
hotmeteor / example_migration.php
Created August 1, 2018 00:20
Database column naming proposal
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateMyTable extends Migration
{
/**
* Run the migrations.
@hotmeteor
hotmeteor / AppointmentReminder.php
Last active February 25, 2020 07:49
Handling delayed notifications in Laravel, pt. 2
<?php
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Notification;
use Illuminate\Queue\SerializesModels;
class AppointmentReminder extends Notification implements ShouldQueue
@hotmeteor
hotmeteor / AppointmentReminder.php
Created February 17, 2018 23:34
Handling delayed notifications in Laravel, pt. 1
<?php
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Notification;
use Illuminate\Queue\SerializesModels;
class AppointmentReminder extends Notification implements ShouldQueue
@hotmeteor
hotmeteor / EventServiceProvider.php
Last active February 17, 2018 23:34
Handling delayed notifications in Laravel, pt. 3
<?php
namespace App\Base\Providers;
use App\Notifications\Listeners\NotificationSendingListener;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
use Illuminate\Notifications\Events\NotificationSending;
class EventServiceProvider extends ServiceProvider
{