Skip to content

Instantly share code, notes, and snippets.

View tomardern's full-sized avatar

Tom Ardern tomardern

  • Midnite.com
  • London
View GitHub Profile
@tomardern
tomardern / package.json
Created April 8, 2018 14:19
Angular + OnChange (Watch) + Pug
{
"name": "ng-tutorial",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"pug:watch": "./node_modules/onchange/cli.js \"./src/app/**/*.pug\" -d 250 -- node node_modules/pug-cli/index.js {{changed}}",
"dev": "f(){ npm run pug:watch & ng serve ;};f",
"ng": "ng",
"start": "ng serve",
"build": "ng build --prod",
/**
* Catch all promise function
* @param {Object} func
* @param {Request} request
* @param {Response} response
*/
const fn = (func, request, response) => {
console.log(request.method, request.originalUrl);
const params = Object.assign({}, request.params, request.query, request.body);
try {
@tomardern
tomardern / gist:5f68bf536fbb5ef640f21e13771f1f03
Created February 25, 2018 14:35
brackleypartners redirects
www.brackleypartners.co.uk/ourTeam.html
www.brackleypartners.co.uk/contactUs.html
www.brackleypartners.co.uk/professionalChangeWithMeasureWork.html
www.brackleypartners.co.uk/managementDevelopmentProgrammes.html
www.brackleypartners.co.uk/madeToMeasure.html
www.brackleypartners.co.uk/howDoesMadeToMeasureWork.html
www.brackleypartners.co.uk/ourValues.html
www.brackleypartners.co.uk/whatIsMadeToMeasure.html
www.brackleypartners.co.uk/executiveCoaching.html
www.brackleypartners.co.uk/occupationalAssessment.html
@tomardern
tomardern / script.gs
Created November 14, 2017 15:38
Google Script as web app
function doPost(req) {
var jsonString = req.postData.getDataAsString();
var data = JSON.parse(jsonString);
var sheetId = data.spreadsheetId;
var spreadsheet = SpreadsheetApp.openById(sheetId);
var sheet = spreadsheet.getSheets()[0];
// Get the last row (The one we want to write into)
var rowIndex = sheet.getLastRow() + 1;
<!DOCTYPE html>
<html>
<head>
<title>My first three.js app</title>
<style>
body { margin: 0; }
canvas { width: 100%; height: 100% }
</style>
</head>
<body>
<!DOCTYPE html>
<html>
<head>
<title>My first three.js app</title>
<style>
body { margin: 0; }
canvas { width: 100%; height: 100% }
</style>
</head>
<body>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<!DOCTYPE html>
<html>
<head>
<title>My first three.js app</title>
<style>
body { margin: 0; }
canvas { width: 100%; height: 100% }
</style>
</head>
<body>
@tomardern
tomardern / index.js
Created October 22, 2017 16:39
Express Function Logging in Firebase functions
const functions = require('firebase-functions');
const express = require('express');
const cors = require('cors');
const bodyParser = require('body-parser');
/**
* Route all firebase function requests through to express
* See https://codeburst.io/express-js-on-cloud-functions-for-firebase-86ed26f9144c
*/
const app = express();
@tomardern
tomardern / component.js
Created October 19, 2017 13:02
Angular ES6 Component Style
const DEMO_COMPONENT_NAME = "demoComponent";
// before angular 1.5 component : directive was the way to create component
const demoComponent = {
template: '<h1>Hello world</h1><h2>{{$ctrl.domAttribute}}</h2>',
bindings: {
domAttribute: '@',
onSomething: '&', // function call out
demoAttr2: "<" // Data in