Skip to content

Instantly share code, notes, and snippets.

View adrhumphreys's full-sized avatar
🐙

Adrian Humphreys adrhumphreys

🐙
View GitHub Profile
const { transform } = require("@svgr/core");
const defaultTemplate = (variables, { tpl }) => {
return tpl`
${variables.imports};
${variables.interfaces};
export const ${variables.componentName} = (${variables.props}) => (
${variables.jsx}
);
@adrhumphreys
adrhumphreys / react.json
Created February 6, 2022 07:44
VSCode Snippets
{
"consoleLog": {
"prefix": "clg",
"body": "console.log(${1:first});",
"description": "Displays a message in the console",
"scope": "typescript,typescriptreact,javascript,javascriptreact"
},
"consoleLogObject": {
"prefix": "clo",
"body": "console.log('${1:first}', ${1:first});",
@adrhumphreys
adrhumphreys / index.php
Created April 8, 2021 07:56
Basic request logger
<?php
/**
* Log requests, any route to a url aside from / and /view will be logged
* View a list of logged requests by going to /
* View a specific request by going to /view?key=timestamp
* Logs are stored in a log.json file that's relative to the file
* Run via `php -S localhost:8080`
*/
@adrhumphreys
adrhumphreys / ElementalAreaField.patch
Last active August 15, 2020 22:24
Layout block dreams
diff --git a/src/Forms/ElementalAreaField.php b/src/Forms/ElementalAreaField.php
index e767d73..4b71d8e 100644
--- a/src/Forms/ElementalAreaField.php
+++ b/src/Forms/ElementalAreaField.php
@@ -215,6 +215,11 @@ class ElementalAreaField extends GridField
public function setSubmittedValue($value, $data = null)
{
+ // Nested elemental areas will have an array passed to them
+ if (is_array($value)) {
@adrhumphreys
adrhumphreys / .edgerc
Created May 27, 2020 02:54
Purge a set of URLs in Akamai
[default]
host = put
client_token = your
client_secret = settings
access_token = here
@adrhumphreys
adrhumphreys / example_output.json
Created March 3, 2020 00:47
Count the instances of a GET param in a list of URLs
{
"?b": 1,
"a": 4,
"abc": 1,
"b": 1,
"wow": 3
}
@adrhumphreys
adrhumphreys / commands.sql
Last active February 10, 2020 00:32
Copy directory of files into mysql along with the modified dates
# Set correct date/time stamps for mysql
UPDATE files_table
SET some_datetime_column = STR_TO_DATE(last_modified, '%Y-%m-%d %T +1200 NZST')
WHERE files_table.last_modified LIKE '%+1200 NZST'
@adrhumphreys
adrhumphreys / projects.md
Created July 21, 2019 21:12 — forked from ScopeyNZ/projects.md
Guy's on-going/unfinished SilverStripe projects
@adrhumphreys
adrhumphreys / 1readme.md
Last active November 6, 2018 03:17
Broken many_many SS4 example

Steps to reproduce:

  1. Navigate to wow admin
  2. Create a wow object, title: wow
  3. Create a wow object, title: wow2
  4. Navigate to a page
  5. Navigate to wow tab
  6. Search for "wow" in the link existing field
  7. Click link exisiting

Expected outcome:

@adrhumphreys
adrhumphreys / gruvbox.itermcolors
Last active July 22, 2018 20:18
Install osx and jazz
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.15686275064945221</real>