Skip to content

Instantly share code, notes, and snippets.

View RobMacKay's full-sized avatar
🏠
Working from home

Rob RobMacKay

🏠
Working from home
View GitHub Profile
@RobMacKay
RobMacKay / wordpress_cors.php
Last active November 14, 2019 18:19
Simple CORS for WordPress with domain control.
//Add it in your Functions file at the least
//Created a function to hook into the init.
//
function add_cors_http_header(){
//An Array of allowed domains.
$allowed = array(
"http://localhost:3000",
"http://another-domain.com"
@RobMacKay
RobMacKay / acf_languages.txt
Created September 7, 2020 10:10
ACF Languages Selection List
aa : Afar
ab : Abkhazian
af : Afrikaans
ak : Akan
am : Amharic
ar : Arabic
an : Aragonese
as : Assamese
av : Avaric
ae : Avestan
@RobMacKay
RobMacKay / acf_countries.txt
Created September 7, 2020 10:12
ACF Countries Selection List
AF : Afghanistan
AX : Aland Islands
AL : Albania
DZ : Algeria
AS : American Samoa
AD : Andorra
AO : Angola
AI : Anguilla
AQ : Antarctica
AG : Antigua and Barbuda
@RobMacKay
RobMacKay / Example.js
Created September 17, 2020 07:33
Example Stateful Functional Component React.
import React, {useEffect, useState} from 'react'
export default function Example(props) {
// you don't have to call these state and setState.
const [state, setState] = useState([state])
// Think of this as ComponentDidMount
useEffect(() => {
AED : United Arab Emirates dirham
AFN : Afghan afghani
ALL : Albanian lek
AMD : Armenian dram
ANG : Netherlands Antillean guilder
AOA : Angolan kwanza
ARS : Argentine peso
AUD : Australian dollar
AWG : Aruban florin
AZN : Azerbaijani manat
@RobMacKay
RobMacKay / FilamentPHP_Snippet.php
Created February 29, 2024 21:48
FilamentPHP 3 Create Slug from Title
<?php
Forms\Components\TextInput::make('title')
->required()
->live(true)
->afterStateUpdated(fn (Set $set, ?string $state) => $set('slug', Str::slug($state))),
Forms\Components\TextInput::make('slug')
->disabled()
->dehydrated()
->maxLength(255)
->unique(Page::class, 'slug', ignoreRecord: true),