Skip to content

Instantly share code, notes, and snippets.

View joshangell's full-sized avatar

Josh Angell joshangell

View GitHub Profile
@joshangell
joshangell / PhpStorm-and-Gridsome.md
Last active December 21, 2022 10:13
Quick and dirty explanation of how to get autocomplete, syntax highlighting etc when using Gridsome in PhpStorm.

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 September 14, 2017 10:58
Varnish 5.0 for Craft CMS
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

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 February 1, 2016 14:07
Content migration in Craft example.
<?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 January 26, 2021 00:48
Sets up a new Craft project in the ~/Sites folder with a bunch of plugins and boilerplate. Geared towards OSX users.
#!/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 January 5, 2022 11:35
Varnish config for Craft
# 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 December 20, 2012 10:15
Simple script for setting up a new local site on a mac's native apache.
#!/bin/bash
echo "enter directory path, leave blank for current"
read DOCROOT
if [ -z "$DOCROOT" ];
then
DOCROOT="$PWD"
fi
@joshangell
joshangell / rem.scss
Created September 14, 2012 15:09
rem() is a Sass mixin that converts pixel values to rem values.
/* '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 October 15, 2011 20:53 — forked from nedmas/gist:1287451
Just a simple bash script for adding new sites on an apache server
#!/bin/bash
while getopts ":h:p:a:d:l:" opt; do
case $opt in
h)
HOST="$OPTARG"
;;
p)
PORT="$OPTARG"
;;