Skip to content

Instantly share code, notes, and snippets.

Avatar

Josh Angell joshangell

View GitHub Profile
@joshangell
joshangell / PhpStorm-and-Gridsome.md
Last active Apr 19, 2021
Quick and dirty explanation of how to get autocomplete, syntax highlighting etc when using Gridsome in PhpStorm.
View PhpStorm-and-Gridsome.md

PhpStorm

  1. Make sure your gridsome dev server is running: cd frontend and then yarn dev or npm run dev
  2. Install JS GraphQL plugin: https://jimkyndemeyer.github.io/js-graphql-intellij-plugin/
  3. Select everything inside <page-query>, click the light bulb icon, choose "Inject language or reference" and select GraphQL, like this:

NOTE: you only have to do this once and then all your .vue files will support GraphQL queries inside <page-query> tags.

@joshangell
joshangell / default.vcl
Created Sep 14, 2017
Varnish 5.0 for Craft CMS
View default.vcl
vcl 4.0;
import xkey;
# Based on: https://github.com/mattiasgeniar/varnish-4.0-configuration-templates/blob/master/default.vcl
import std;
import directors;
backend server1 { # Define one backend
.host = "127.0.0.1"; # IP or Hostname of backend
.port = "80"; # Port Apache or whatever is listening
View keybase.md

Keybase proof

I hereby claim:

  • I am joshangell on github.
  • I am angell (https://keybase.io/angell) on keybase.
  • I have a public key whose fingerprint is 9494 0E71 A201 2F9D 9C45 BF20 1102 C463 74D6 64E2

To claim this, I am signing this object:

@joshangell
joshangell / MyPluginController.php
Last active Feb 1, 2016
Content migration in Craft example.
View MyPluginController.php
<?php
namespace Craft;
class MyPluginController extends BaseController
{
// This lets anyone run the controller actions we specify, useful for CRON etc
protected $allowAnonymous = array('actionMigrate');
/**
@joshangell
joshangell / go-craft-go.sh
Last active Jan 26, 2021
Sets up a new Craft project in the ~/Sites folder with a bunch of plugins and boilerplate. Geared towards OSX users.
View go-craft-go.sh
#!/bin/sh
printf "\e[34mEnter name for this site\e[0m\n"
read DOMAIN
if [ -z "$DOMAIN" ];
then
DOMAIN="${PWD##*/}"
fi
@joshangell
joshangell / default.vcl
Last active Sep 28, 2017
Varnish config for Craft
View default.vcl
# Varnish 4.0 configuration for Craft
#
# Based on the following:
# - https://github.com/mattiasgeniar/varnish-4.0-configuration-templates/blob/master/default.vcl
# - https://gist.github.com/aelvan/eba03969f91c1bd51c40
vcl 4.0;
import std;
import directors;
@joshangell
joshangell / newlocalsite.sh
Created Dec 20, 2012
Simple script for setting up a new local site on a mac's native apache.
View newlocalsite.sh
#!/bin/bash
echo "enter directory path, leave blank for current"
read DOCROOT
if [ -z "$DOCROOT" ];
then
DOCROOT="$PWD"
fi
@joshangell
joshangell / rem.scss
Created Sep 14, 2012
rem() is a Sass mixin that converts pixel values to rem values.
View rem.scss
/* 'rem' is a Sass mixin that converts pixel values to rem values
* Returns 2 lines of code — regular pixel values and converted rem values
*
* Sample input:
* .element {
* @include rem('padding',10px 0 2px 5px); }
*
* Sample output:
* .element {
* padding: 10px 0 2px 5px;
@joshangell
joshangell / gist:1290120
Created Oct 15, 2011 — forked from nedmas/gist:1287451
Just a simple bash script for adding new sites on an apache server
View gist:1290120
#!/bin/bash
while getopts ":h:p:a:d:l:" opt; do
case $opt in
h)
HOST="$OPTARG"
;;
p)
PORT="$OPTARG"
;;