Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
Opening The Sauce

Andrew McLagan andrewmclagan

:octocat:
Opening The Sauce
  • Atomi
  • Melbourne, Australia
View GitHub Profile
@andrewmclagan
andrewmclagan / igor-example.js
Created Aug 20, 2020
Dependancy mocking in JS
View igor-example.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 Jul 17, 2020
Beam Tech Interview - Bruno.
View general.md

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.


View tree-project.html
<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 Sep 5, 2019 — forked from matzeeable/is_rest.php
Checks if the current request is a WP REST API request.
View is_rest.php
<?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 Nov 7, 2018
Search title translation reference
View taxonomy-search-titles.md

none

"All jobs"

Location

"Jobs in Melbourne"

"Jobs in {location}"

@andrewmclagan
andrewmclagan / criteriaQuery.php
Last active May 1, 2018
Style of naming and namespacing
View criteriaQuery.php
/*
|--------------------------------------------------------------------------
| Class has function only
|--------------------------------------------------------------------------
*/
use App\Criteria;
$jobs = $repository
->addCriteria(Criteria\Jobs\Approved::class)
View create-cluster.sh
gcloud container clusters create animals-app \
--zone=us-central1-a \
--machine-type=n1-standard-1 \
--num-nodes=3 \
--no-enable-autorepair
View Dockerfile
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 Apr 11, 2018
docker package manager installation
View Dockerfile
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
View Dockerfile
FROM node:8-alpine
MAINTAINER andrewmclagan
# ...