Skip to content

Instantly share code, notes, and snippets.

View nicdford's full-sized avatar

Nic Ford nicdford

View GitHub Profile
@nicdford
nicdford / gist:6284626f32f1eb5d1d738322d8d34088
Created April 24, 2024 20:35
ActionButton "case" statement
interface InternalActivityTableActionsProps extends Omit<ButtonProps, "label"> {
status: DisplayStatus;
actions: {
onStartButtonClick: ButtonProps["onClick"];
onContinueButtonClick: ButtonProps["onClick"];
onNoActionButtonClick: ButtonProps["onClick"];
onViewDataButtonClick: ButtonProps["onClick"];
};
}
@nicdford
nicdford / adding-layers-to-mapbox-willy-nilly.ts
Last active June 7, 2022 18:50
Quick snippet for adding turf features as mapbox layers on a map for testing
map.addSource('debugging', {
type: 'geojson',
data: intersectFeature,
})
map.addLayer({
id: 'debugging',
type: 'fill',
source: 'debugging',
layout: {},
{
"plugins": ["stylelint-order", "stylelint-scss"],
"extends": "stylelint-config-prettier",
"rules": {
"at-rule-no-unknown": null,
"at-rule-empty-line-before": [
"always",
{
"except": [
"blockless-after-same-name-blockless",
@nicdford
nicdford / script.js
Last active August 28, 2020 17:40
JS to convert Make Page Builder sections into Accordion Items
const accordion_items = document.querySelectorAll('.wsu-js-accordion-item');
accordion_items.forEach(item => {
// Set initial state
const child_divs = Array.from(item.children);
child_divs.forEach(element => {
if (element.classList.contains('column') && !element.classList.contains('toggle-visible')) {
element.classList.add('toggle-visible');
const path = require('path');
const defaultConfig = require( '@wordpress/scripts/config/webpack.config' );
console.log();
console.log('nic look here')
module.exports = {
...defaultConfig,
module: {
// Line 143 - Missing input labels
$content .= sprintf( "<td data-label='%s' class='%s'><label for='%s'><span class='screen-reader-text'>%s</span></label><input name='%s' type='radio' title='test' value='%s' %s id='%s' %s %s %s/></input></td>", esc_attr( wp_strip_all_tags( $choice['text'], true ) ), $cell_class, $input_id, $input_name, $input_name, esc_attr( $field_value ), $checked, $input_id, $disabled_text, $this->get_tabindex(), $logic_event );
// Line 95 - Missing table header
$content .= "<th scope='col' class='gsurvey-likert-row-label'><span class='screen-reader-text'>Column selection options</span></th>";
{"lastUpload":"2020-12-18T19:18:55.936Z","extensionVersion":"v3.4.3"}
@nicdford
nicdford / gist:adcb40396eaffadf242636a3936a5172
Created September 5, 2019 23:40
Shortcode to display posts headlines by category
[wsuwp_json host="provost.wsu.edu" category="faculty-development" count="10" output="headlines" cache_bust="0"]
@nicdford
nicdford / gist:7b5dcf3b44431e590057626aa69578c2
Created March 20, 2018 00:46
Create excerpt from variable
/**
* Create excerpt from content
*/
function pac_create_exerpt( $content ) {
return wp_trim_words($content, 15, '...');
}
@nicdford
nicdford / gist:a19eec2de96209e319ab0eabb8721109
Created March 20, 2018 00:36
Custom Simple Relationship where param list pods values
<?php
$params = array(
'limit' => 3,
'where' => "source.meta_value = 'google'" // Relationship (Custom Simple)
);
$pods = pods( 'testimony', $params );
if ( !empty( $pods ) ) {
while ($pods->fetch()){