Skip to content

Instantly share code, notes, and snippets.

Avatar

rachel cantor rachelslurs

View GitHub Profile
@rachelslurs
rachelslurs / setup-devcontainer-in-vscode.md
Last active Jan 26, 2021
How to setup devcontainer in vscode for dashboard
View setup-devcontainer-in-vscode.md

Benefits

  • Run eslint in the docker container
  • Run jest in the docker container (and get updates when snapshots change)
  • Much more, share your tips!

Instructions adapted from here

  1. Install Remote development extension pack
  2. In VSCode, control+shift+p, Remote-Containers: Add Development Container Configuration Files. Choose From 'docker-compose.yml'. This should create a folder .devcontainer which is .gitignored.
  3. Edit the .devcontainer/devcontainer.json file. Ensuring a few different settings:
@rachelslurs
rachelslurs / docker-setup.sh
Last active Feb 4, 2021
Setting up docker-engine and docker-compose on an AMD64 linux machine running Ubuntu/PopOS
View docker-setup.sh
# remove any existing things
sudo apt-get remove docker docker-engine docker.io containerd runc
# install docker engine
# add repo with trusted key
sudo apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
@rachelslurs
rachelslurs / content_chopper.php
Created Jun 20, 2018
An example of a plugin that chops content the pre Gutenberg way
View content_chopper.php
<?php
/*
Plugin Name: Content Chopper
Plugin URI: https://github.com/rachelslurs
Description: A simple content chopper
Version: 1.0
Author: Rachel Cantor
Author URI: https://github.com/rachelslurs
License: GPL2
*/
@rachelslurs
rachelslurs / CountriesContainer.js
Created Nov 7, 2017
Handling a change to Redux-Form data from container to component via props
View CountriesContainer.js
import React, {Component} from 'react'
import {connect} from 'react-redux'
import PropTypes from 'prop-types'
import {FieldArray, getFormValues} from 'redux-form' // import the action creator you need
import CountryPicker from '../components/CountryPicker'
class CountriesContainer extends Component {
constructor(props) {
super(props)
@rachelslurs
rachelslurs / semantic-ui-less-atom.md
Created Aug 12, 2017
Some editor tricks to make Atom easier to theme Semantic UI in
View semantic-ui-less-atom.md

Using Atom with Semantic UI

I've been using Atom with Semantic UI and found some tweaks to be helpful when theming.

Getting the syntax for .variables and .overrides to default to LESS

  1. Install the file-types package

  2. Open the config folder and edit the config.cson file

  3. Add a value in alphabetical order for "file-types", unless it's there already.

View semantic-ui-react-quicklinks.md
@rachelslurs
rachelslurs / CountriesContainer.js
Created Aug 1, 2017
Passing a Redux-Form action creator from container to component via React context
View CountriesContainer.js
import React, {Component} from 'react'
import {connect} from 'react-redux'
import PropTypes from 'prop-types'
import {reduxForm, change} from 'redux-form' // import the action creator you need
import CountryPicker from '../components/CountryPicker'
class CountriesContainer extends Component {
static propTypes = {
changeFieldValue: PropTypes.func.isRequired
}
@rachelslurs
rachelslurs / CountriesContainer.js
Last active Jul 31, 2017
Passing a Redux-Form action creator from container to component via React context
View CountriesContainer.js
import React, {Component} from 'react'
import {connect} from 'react-redux'
import PropTypes from 'prop-types'
import {reduxForm, change} from 'redux-form' // import the action creator you need
import CountryPicker from '../components/CountryPicker'
class CountriesContainer extends Component {
static propTypes = {
changeFieldValue: PropTypes.func.isRequired
}
@rachelslurs
rachelslurs / gravity_forms_ugh.php
Last active Mar 30, 2017
This is all work I did when I was thinking we were going to use the gravity forms awful markup
View gravity_forms_ugh.php
/**
* Filters the next, previous and submit buttons.
* Replaces the forms <input> buttons with <button> while maintaining attributes from original <input>.
*
* @param string $button Contains the <input> tag to be filtered.
* @param object $form Contains all the properties of the current form.
*
* @return string The filtered button.
*/
add_filter( 'gform_next_button', 'input_to_button', 10, 2 );
@rachelslurs
rachelslurs / post-issues-bookmarklet.js
Last active Jun 18, 2016
Post and Issue Dummy Images Bookmarklet
View post-issues-bookmarklet.js
javascript:(function() {
var a = document.getElementById('_post_meta_image_alt_text_0');
if (a) {
a.value = 'Some alt text';
}
var b = document.getElementById('_post_meta_image_desktop_0');
if (b) {
b.value = 'https://placehold.it/1400x600/003003/ffffff';
}
var c = document.getElementById('_post_meta_image_desktop_mobile_tile_0');