Skip to content

Instantly share code, notes, and snippets.

View EvanLovely's full-sized avatar

Evan Lovely EvanLovely

View GitHub Profile
@EvanLovely
EvanLovely / machine.js
Created November 18, 2020 22:47
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@EvanLovely
EvanLovely / machine.js
Last active August 24, 2020 20:20
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
{% set data = {
home_away: node.field_home_away_or_neutral.value,
no_audio: node.field_live_audio_unavailable.value,
venue: node.field_venue.entity.name.value,
tv_name: node.field_tv_channel.entity.name.value,
tv_logo: node.field_tv_channel.entity.field_logo.entity.getFileUri(),
competition: node.field_competition.entity.name.value,
competition_logo: node.field_competition.entity.field_logo.entity.getFileUri() | image_style('small'),
date: content.field_fixture_date,
date_override: content.field_date_override,
/**
* @type {{a: boolean, b: boolean, c: number}}
*/
var x = {a: true};
@EvanLovely
EvanLovely / LICENSE.txt
Created July 12, 2018 22:22 — forked from jed/LICENSE.txt
generate random UUIDs
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@EvanLovely
EvanLovely / index.php
Last active January 25, 2018 07:21
Twig PHP CLI Render
<?php
require_once 'vendor/autoload.php';
// Twig docs for this: https://twig.symfony.com/doc/2.x/api.html
// First arg to CLI - template path
$templatePath = $argv[1];
// data is STDIN aka `echo '{"title": "hello there"}' | php index.php '@upone/bar.twig'`
$in_data = [];
$in = fgets(STDIN);
@EvanLovely
EvanLovely / delete-all-dep-folders.sh
Last active June 12, 2017 19:37
Delete dep folders: `node_modules`, `bower_components`
# Delete dep folders: `node_modules`, `bower_components`
# @param $1 [.] Which folder to recursively look in; defaults to cwd (`.`).
delete-all-dep-folders() {
# `-prune` prevents building up lists of `node_modules` inside `node_modules`
find ${1:-.} -type d -name "node_modules" -prune -exec rm -rf '{}' \; -exec echo 'Deleted {}' \;
find ${1:-.} -type d -name "bower_components" -prune -exec rm -rf '{}' \; -exec echo 'Deleted {}' \;
# This one is a little spooky as `vendor/` folders aren't exclusive to Composer.
# @todo Test if `composer.json` is next to `vendor/` before deleting.
# find ${1:-.} -type d -name "vendor" -prune -exec rm -rf '{}' \; -exec echo 'Deleted {}' \;
@EvanLovely
EvanLovely / .vimrc
Created May 24, 2017 21:09 — forked from crittermike/.vimrc
A .vimrc with the bare minimum baseline defaults
set backspace=2 " backspace in insert mode works like normal editor
set shiftwidth=2 " indent by 2 spaces when auto-indenting
set softtabstop=2 " indent by 2 spaces when hitting tab
syntax on " syntax highlighting
filetype indent on " activates indenting for files
set autoindent " auto indenting
set number " line numbers
colorscheme desert " colorscheme desert
set nobackup " get rid of anoying ~file
@EvanLovely
EvanLovely / Checkout github pull requests locally.md
Created May 1, 2017 17:05 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@EvanLovely
EvanLovely / Linking to external resources from the Drupal appearance page.md
Last active April 12, 2017 20:29 — forked from grayside/Instructions.md
Linking to external resources from the Drupal appearance page

Adding links to Pattern Lab on Drupal Appearance page

Add this to THEME-NAME.info.yml:

resources:
  pattern-lab: /themes/custom/THEME_NAME/pattern-lab/public/
  sassdoc: /themes/custom/THEME_NAME/dest/sassdoc/