Skip to content

Instantly share code, notes, and snippets.

View dgowrie's full-sized avatar
🀘

David Gowrie dgowrie

🀘
View GitHub Profile
@dgowrie
dgowrie / react_component_stateless.sublime-snippet
Last active August 19, 2017 21:10
Sublime Text Snippet: react_component_stateless.sublime-snippet
<snippet>
<content><![CDATA[
import React from 'react';
import PropTypes from 'prop-types';
const propTypes = {
};
function ${1:${TM_FILENAME/(.+)\..+|.*/$1/:ComponentName}}(${2:props}) {
@dgowrie
dgowrie / react_class_component.sublime-snippet
Last active August 7, 2017 04:08
Sublime Text Snippet: React: class component
<snippet>
<content><![CDATA[
import React from 'react';
import PropTypes from 'prop-types';
const propTypes = {
name: PropTypes.string,
};
class ${1:${TM_FILENAME/(.+)\..+|.*/$1/:ComponentName}} extends React.Component {
@dgowrie
dgowrie / react-redux-container-component.sublime-snippet
Last active August 9, 2017 07:54
Sublime Text snippet for a React Redux Container Component
<snippet>
<content><![CDATA[
import React from 'react';
import PropTypes from 'prop-types';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
const propTypes = {
name: PropTypes.string,
};
var ReactTable = React.createClass({
getInitialState: function() {
return {currentData: this.props.data};
},
render: function() {
var key = Date.now();
@dgowrie
dgowrie / acf-inline-svg.php
Created January 21, 2018 02:45 — forked from derekshirk/acf-inline-svg.php
Output Inline SVGs from ACF image field
<?php
/* β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” */
/* ACF Inline SVGs
/* β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” */
$repeater = 'repeater_field_name'
if ( have_rows( $repeater ) ): ?>
<section class="content-main">
<div class="container"> <?php
@dgowrie
dgowrie / mixin-transition-props.scss
Last active May 17, 2018 15:09
Sass @mixin for GPU-accelerated transition
@mixin transition-props($property: all) {
transition-property: $property;
transition-duration: .5s;
transition-timing-function: cubic-bezier(.25,.46,.45,.94);
@if ($property != 'opacity') and ($property != 'transform') {
will-change: $property;
}
}
@dgowrie
dgowrie / node-python-virtualenv.md
Created August 9, 2018 15:51
Node in Python virtualenv

From: http://bocribbz.com/post/80417240179/nodejs-in-pythons-virtualenv

Virtualenv is very useful tool, it helps with isolation and solves some redundant administrative works. Node.js also has similar tools, but from them, one stands apart, nodeenv.

What is really great about nodeenv, is that it helps you avoid typing long source commands, and if you are used to virtualenvwrapper, you dont have to learn a new set of commands.

To install it you can follow these quick steps, after you have installed virtualenv and virtualenvwrapper.

@dgowrie
dgowrie / emotion-media-query-macro.js
Created September 6, 2018 18:39
Thin wrapper "macro" for declarative breakpoint media queries in emotion styled components
/**
* Similar to Sass mixins
* Goals are:
* - intuitive, sensible naming convention for ranges
* - declarative syntax
* Two approaches explored...
*/
/* Breakpoints - if we want to keep these as separate variables (pros/cons) */
@dgowrie
dgowrie / SublimeLinter.sublime-settings - User
Last active October 17, 2019 06:15
Sublime Text - SublimeLinter Settings
// SublimeLinter Settings - User
{
"debug": true,
"linters": {
// https://github.com/SublimeLinter/SublimeLinter-eslint/issues/205
// https://github.com/SublimeLinter/SublimeLinter/blob/master/docs/troubleshooting.rst#on-macos
"eslint": {
"disable": false,
"args": [],