Skip to content

Instantly share code, notes, and snippets.

@rachelslurs
rachelslurs / setup-devcontainer-in-vscode.md
Last active January 26, 2021 23:28
How to setup devcontainer in vscode for dashboard

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 February 4, 2021 17:05
Setting up docker-engine and docker-compose on an AMD64 linux machine running Ubuntu/PopOS
# 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 June 20, 2018 22:25
An example of a plugin that chops content the pre Gutenberg way
<?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 November 7, 2017 21:56
Handling a change to Redux-Form data from container to component via props
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 August 12, 2017 00:36
Some editor tricks to make Atom easier to theme Semantic UI in

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.

@rachelslurs
rachelslurs / semantic-ui-react-quicklinks.md
Created August 6, 2017 23:09
Semantic UI React Quicklinks
@rachelslurs
rachelslurs / CountriesContainer.js
Created August 1, 2017 15:03
Passing a Redux-Form action creator from container to component via React context
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 July 31, 2017 22:29
Passing a Redux-Form action creator from container to component via React context
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 March 30, 2017 04:19
This is all work I did when I was thinking we were going to use the gravity forms awful markup
/**
* 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 June 18, 2016 19:11
Post and Issue Dummy Images Bookmarklet
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');