Skip to content

Instantly share code, notes, and snippets.

View andrewmclagan's full-sized avatar
:octocat:
Opening The Sauce

(Rew) Andrew McLagan andrewmclagan

:octocat:
Opening The Sauce
  • Atomi
  • Melbourne, Australia
View GitHub Profile
@andrewmclagan
andrewmclagan / igor-example.js
Created August 20, 2020 04:44
Dependancy mocking in JS
// addNumbers.js
import calculator from 'calculator';
export default function addNumbers(a, b) {
return calculator.add(a, b);
}
// addNumbers.spec.js
@andrewmclagan
andrewmclagan / general.md
Last active July 17, 2020 01:08
Beam Tech Interview - Bruno.

Below are general senior level full stack developer Q&As.


1. GraphQL vs RESTful

List some issues within RESTful APIs that GraphQL attempts to solve.


<div style="height: 700px; position: relative; overflow-y: hidden;">
<div
style="
height: 46px;
width: 150px;
position: absolute;
background: #536978;
z-index: 9999;
right: 5px;
"
@andrewmclagan
andrewmclagan / is_rest.php
Created September 5, 2019 11:05 — forked from matzeeable/is_rest.php
Checks if the current request is a WP REST API request.
<?php
if ( !function_exists( 'is_rest' ) ) {
/**
* Checks if the current request is a WP REST API request.
*
* Case #1: After WP_REST_Request initialisation
* Case #2: Support "plain" permalink settings
* Case #3: It can happen that WP_Rewrite is not yet initialized,
* so do this (wp-settings.php)
@andrewmclagan
andrewmclagan / taxonomy-search-titles.md
Last active November 7, 2018 00:34
Search title translation reference

none

"All jobs"

Location

"Jobs in Melbourne"

"Jobs in {location}"

@andrewmclagan
andrewmclagan / criteriaQuery.php
Last active May 1, 2018 00:36
Style of naming and namespacing
/*
|--------------------------------------------------------------------------
| Class has function only
|--------------------------------------------------------------------------
*/
use App\Criteria;
$jobs = $repository
->addCriteria(Criteria\Jobs\Approved::class)
gcloud container clusters create animals-app \
--zone=us-central1-a \
--machine-type=n1-standard-1 \
--num-nodes=3 \
--no-enable-autorepair
FROM php:7.2-fpm-alpine3.7
MAINTAINER "Andrew McLagan"
RUN apk --no-cache add \
freetype libpng libjpeg-turbo freetype-dev libpng-dev libjpeg-turbo-dev \
wget \
git \
supervisor \
bash \
@andrewmclagan
andrewmclagan / Dockerfile
Created April 11, 2018 11:44
docker package manager installation
FROM node:8-alpine
# Add package manger file and lock file
COPY package.json yarn.lock /usr/src
# Install dependancies from lockfile and clean package manager cache
RUN yarn install --pure-lockfile && \
yarn cache clean
# Add your application source
FROM node:8-alpine
MAINTAINER andrewmclagan
# ...