Skip to content

Instantly share code, notes, and snippets.

View joshdcomp's full-sized avatar

Josh Compton joshdcomp

View GitHub Profile
@joshdcomp
joshdcomp / _icon.es16.jsx
Last active August 18, 2016 15:07
Generic icon React component for use with SVG glyphs
import React, { Component } from 'react';
// _icon is my namespacing choice for glyphs--it could easily be set
// as an env variable
export default class Icon extends Component {
fullName(href='') {
return `#${href}_icon-${this.props.glyph}`;
}
render() {
@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',
@joshdcomp
joshdcomp / footer.jsx
Created August 18, 2016 15:21
Example <Icon /> implementation
@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 / 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 / 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 / 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": "...",