Skip to content

Instantly share code, notes, and snippets.

Avatar

Gavin trickydisco78

View GitHub Profile
View machine.js
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
View gtm.js
{
"exportFormatVersion": 2,
"exportTime": "2018-07-20 07:24:19",
"containerVersion": {
"path": "accounts/1164259306/containers/9071728/versions/0",
"accountId": "1164259306",
"containerId": "9071728",
"containerVersionId": "0",
"container": {
"path": "accounts/1164259306/containers/9071728",
View hero.jsx
import React, { useState, useEffect } from 'react'
import GatsbyImage from 'gatsby-image'
const useWindowWidth = () => {
if (typeof window === 'undefined') return 400
const [windowWidth, setWindowWidth] = useState(window.innerWidth)
const handleWindowResize = () => {
setWindowWidth(window.innerWidth)
}
View articles.json
{
"2019-08-21": [
{
"node": {
"id": "Prismic__NewsArticle__XV0etREAACEAudtR",
"uid": "bjorn-engels-when-wesley-gets-his-big-chance-hell",
"last_publication_date": "2019-08-21T10:36:41+0000",
"data": {
"article_title": {
"html": "<h1>Björn Engels: When Wesley gets his big chance, he&#39;ll take it</h1>",
View component.jsx
import React, { Component } from 'react';
import { connect } from 'react-redux';
import queryString from 'querystring';
import {
toggleScrollLock,
toggleForm,
submitForm,
showErrorPage,
setTrackingUrl,
} from '../../../client/actions';
View Hero.tsx
import * as React from 'react'
import Img from 'gatsby-image'
import { renameProp, renameKeys } from '../../utils/renameprop'
import HeroText from './heroText'
import './hero.css'
interface IHeroProps {
heroImg?: object
}
View news.tsx
import * as React from 'react'
import Deanna from '../../assets/images/news/Deanna-thumb.jpg'
import LightsWW18 from '../../assets/images/news/LightsWW18-thm.jpg'
import causerresearch from '../../assets/images/news/commoncauseresearch-thumb.jpg'
import impossiblegarden from '../../assets/images/news/Impossible-garden-thumb.jpg'
import LazyLoad from 'react-lazyload'
import rssParser from 'rss-parser'
let parser = new rssParser()
export interface IAppProps {}
View searchfunction.js
function buildSearchQuery(year,courseType,keyword) {
const searchOptions = {
undergraduate: `?query=${keyword}&sort=score&dir=desc&sort=UndergraduateCourse-programname&dir=asc&filter%3AUndergraduateCourse-year=${year}`,
postgraduate: `?query=${keyword}&sort=score&dir=desc&sort=PostgraduateCourse-programtype&dir=asc&sort=PostgraduateCourse-programname&dir=asc${year}`,
}
return searchOptions[courseType]
}
View gist:471286339de564f7aa85ecc008bc8625
import express from 'express';
import proxy from 'http-proxy-middleware';
import compression from 'compression';
import apicache from 'apicache';
let cors = require('cors');
let helmet = require('helmet');
require('dotenv').config();
let cache = apicache.middleware;
// whitelist domains
View results.json
{
"records": [
{
"id": "rec04z85mBhKGIRrx",
"fields": {
"partner_university": "Ecole Nationale d'Ingenieurs de Metz",
"Country": [
"recUu0leCdneWgCFA"
],
"erasmus": "Yes",