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 / generate_timezone_list.php
Last active February 12, 2023 23:03
[PHP] Generate a timezone list with optgroups
/**
* Inspired by http://stackoverflow.com/questions/1727077/generating-a-drop-down-list-of-timezones-with-php
* @return array
*/
function generate_timezone_list()
{
static $regions = [
'Africa' => DateTimeZone::AFRICA,
'Americas' => DateTimeZone::AMERICA,
@hotmeteor
hotmeteor / facebook
Last active December 5, 2022 20:30
Social media meta tag templates
<!-- Social: Facebook / Open Graph -->
<meta property="fb:admins" content="503386332">
<meta property="fb:app_id" content="1389892087910588">
<meta property="og:url" content="http://scotch.io/bar-talk/bootstrap-3-tips-and-tricks-you-might-not-know">
<meta property="og:type" content="article">
<meta property="og:title" content="Bootstrap 3 Tips and Tricks You Might Not Know">
<meta property="og:image" content="/wp-content/uploads/2014/05/bs31.jpg"/>
<meta property="og:description" content="Bootstrap 3 has a ton of features and helpers to speed up front-end development. Sometimes you need something and you end up writing your own custom CSS and JavaScript without even realizing that Bootstrap could have done it for you....">
<meta property="og:site_name" content="Scotch">
<meta property="article:author" content="https://www.facebook.com/NCerminara">
@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 / 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 / .sublime-keymap
Last active September 7, 2018 12:16
Sublime backtick auto-pair
{ "keys": ["`"], "command": "insert_snippet", "args": {"contents": "`$0`"}, "context":
[
{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
{ "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|\\}|>|$)", "match_all": true },
{ "key": "preceding_text", "operator": "not_regex_contains", "operand": "[`a-zA-Z0-9_]$", "match_all": true },
{ "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.backtick", "match_all": true }
]
},
{ "keys": ["`"], "command": "insert_snippet", "args": {"contents": "`${0:$SELECTION}`"}, "context":