Skip to content

Instantly share code, notes, and snippets.

View joshdcomp's full-sized avatar

Josh Compton joshdcomp

View GitHub Profile
@joshdcomp
joshdcomp / html-web-include.html
Last active April 23, 2019 19:27
An IE-inclusive native html include pattern based on https://www.filamentgroup.com/lab/html-includes/
<iframe
src="/asset/you/wanna/include.html"
style="visibility: collapse; position: absolute; height: 0; width: 0;left: -100%;top: -100%;"
onload="this.parentNode.insertBefore((this.contentDocument.body || this.contentDocument).firstChild, this);this.parentNode.removeChild(this)"
></iframe>
@joshdcomp
joshdcomp / package.json
Created November 5, 2018 16:29
webpack config for scss, react, can include ssr but that's another gist
{
"name": "nm-engineering-tech-blog",
"main": "src/server/server.js",
"engines": {
"node": "^8.9.1"
},
"scripts": {
"start": "...",
"dev": "rimraf ./dist && yarn build:copy && export NODE_ENV=dev && ./node_modules/.bin/nodemon --exec 'yarn server'",
"server": "...",
@joshdcomp
joshdcomp / guybot.md
Last active August 8, 2017 18:15
Proposal for a less-scolding autoresponse in nyctech.slack.com's guybot auto-responder

Did you know guys can be seen as exclusive language? Consider $generNeutralTerm instead. $articleLink Come to #guybot-discussions for more information

@joshdcomp
joshdcomp / util-action-types.js
Created July 13, 2017 16:16
generate a map of action types for use in Flux or Redux from an array
export const actionTypes = [
'ACTION_NAME',
].reduce((actions, action) => {
actions[action] = action;
return actions
}, {});
//will output { ACTION_NAME: 'ACTION_NAME' }
@joshdcomp
joshdcomp / util-action-types.js
Created July 13, 2017 16:16
generate a map of action types for use in Flux or Redux from an array
export const actionTypes = [
'ACTION_NAME',
].reduce((actions, action) => {
actions[action] = action;
return actions
}, {});
//will output { ACTION_NAME: 'ACTION_NAME' }
@joshdcomp
joshdcomp / admin-settings.php
Created March 16, 2017 17:38
Set up an options page with text fields for fb, twitter, & github
<?php
/**
* Sets up theme-wide options
*
* @since _geekery_ 1.0
*/
use Carbon_Fields\Container;
use Carbon_Fields\Field;
Container::make('theme_options', 'Geekery settings')
@joshdcomp
joshdcomp / footer.jsx
Created August 18, 2016 15:21
Example <Icon /> implementation
@joshdcomp
joshdcomp / _icon.jsx
Last active August 18, 2016 15:37
ES16 ReactJS Generic Icon component for use with SVG sprites
import React, { Component } from 'react';
export default class Icon extends Component {
fullName(href='') {
return `#${href}_icon-${this.props.glyph}`;
}
render() {
const { glyph } = this.props;
let wrapperClasses = [
'_icon',