Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am lstanard on github.
  • I am jarls (https://keybase.io/jarls) on keybase.
  • I have a public key ASCPwZ-C35DgYlEbbj-7QX9ylqnp_JKxYDghjec4KBuozwo

To claim this, I am signing this object:

@lstanard
lstanard / PickAndRequireAll.ts
Last active October 1, 2020 22:08
TypeScript: Combination pick and make all propertites required
type PickAndRequireAll<T, K extends keyof T> = {
[P in K]-?: T[P];
};
@lstanard
lstanard / ReactFunctionComponent.jsx
Last active June 17, 2020 20:42
Sample of various patterns and standards for FWI function components (based on https://gist.github.com/markerikson/47fff93c92286db72b22bab5b02e2da3)
import React from "react";
import PropTypes from "prop-types";
const MyComponent = ({ prop1, prop2, className }) => {
let someMessage = "This is a message, it may change";
// If a value could change use `let` and if/else statements rather
// than a function that returns a value.
if (prop1) {
someMessage = "The message has changed based on some condition";
@lstanard
lstanard / acf-export-2018-01-18
Last active January 18, 2018 18:00
Catalyst WP Atom Organism Fields
[
{
"key": "group_5719a52cf2cb2",
"title": "Organisms",
"fields": [
{
"key": "field_5719a52e1711e",
"label": "Organism",
"name": "organism",
"type": "repeater",
<?php
/**
* Create ACF setting page under Events CPT menu
*
* @since 1.0.0
*/
if ( function_exists( 'acf_add_options_sub_page' ) ){
acf_add_options_sub_page(array(
'title' => 'Event Settings',
'parent' => 'edit.php?post_type=events',
@lstanard
lstanard / gist:1f69829eceff8075275aa30611b38006
Created May 8, 2017 18:22
WordPress wp-config.php settings for writing to debug.log file
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_DISPLAY', false );
define( 'WP_DEBUG_LOG', true );
@lstanard
lstanard / simple-debug-log.php
Last active March 7, 2018 21:12
WordPress plugin to write debug_log to debug.log file
<?php
/*
Plugin Name: Simple Debug Log
*/
if ( ! function_exists('debug_log')) {
function debug_log ( $log ) {
if ( is_array( $log ) || is_object( $log ) ) {
error_log( print_r( $log, true ) );
} else {
<?php
// Bokka Utilities must be loaded before all other mu-plugins
// as it contains global variables used elsewhere.
require WPMU_PLUGIN_DIR.'/bokka-wp-utilities/bokka-utilities.php';
require WPMU_PLUGIN_DIR.'/bokka-wp-mvc/bokka-mvc.php';
@lstanard
lstanard / .gitignore
Created March 30, 2017 23:58
Default Bokka WordPress .gitignore file
# WordPress #
############
# patternlab-php-master/
# wp-config-local.php
# wp-content/uploads
# wp-content/plugins/debug-log.php
# wp-content/blogs.dir/
# wp-config.php
# wp-content/upgrade/
# wp-content/backup-db/
~: cd ~/vagrants/
[develop] vagrants: vagrant up --provision
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'ubuntu/trusty64' is up to date...
==> default: [vagrant-hostsupdater] Checking for host entries
==> default: [vagrant-hostsupdater] found entry for: 192.168.50.4 vvv
==> default: [vagrant-hostsupdater] found entry for: 192.168.50.4 vvv.dev
==> default: [vagrant-hostsupdater] found entry for: 192.168.50.4 local.wordpress.dev
==> default: [vagrant-hostsupdater] found entry for: 192.168.50.4 src.wordpress-develop.dev
==> default: [vagrant-hostsupdater] found entry for: 192.168.50.4 build.wordpress-develop.dev