Skip to content

Instantly share code, notes, and snippets.

View psyked's full-sized avatar

James Ford psyked

View GitHub Profile
@psyked
psyked / gist:5729474
Created June 7, 2013 14:02
Regex find & replace to swap expect & toBe parameters for Jasmine tests
expect\(([#a-zA-Z0-9,.'\(\) ]*?)\)\.toBe\(([#a-zA-Z0-9,.'\(\) ]*?)\);
expect($2).toBe($1);
@psyked
psyked / gist:5847065
Last active November 13, 2018 15:35
JavaScript Observer Pattern - Module Pattern implementation
var Observable = (function()
{
"use strict";
/**
* @constructor
* @returns {{attach: Function, detach: Function, notify: Function}}
*/
var constructor = function()
{
This file has been truncated, but you can view the full file.
{"lighthouseVersion":"1.4.1","generatedTime":"2017-01-27T21:08:44.717Z","initialUrl":"https://www.psyked.co.uk/","url":"https://www.psyked.co.uk/","audits":{"is-on-https":{"score":true,"displayValue":"","rawValue":true,"name":"is-on-https","category":"Security","description":"Site is on HTTPS","helpText":"All sites should be protected with HTTPS, even ones that don't handle sensitive data. HTTPS prevents intruders from tampering with or passively listening in on the communications between your app and your users, and is a prerequisite for HTTP/2 and many new web platform APIs. [Learn more](https://developers.google.com/web/tools/lighthouse/audits/https)."},"redirects-http":{"score":true,"displayValue":"","rawValue":true,"name":"redirects-http","category":"Security","description":"Site redirects HTTP traffic to HTTPS","helpText":"If you've already set up HTTPS, make sure that you redirect all HTTP traffic to HTTPS. [Learn more](https://developers.google.com/web/tools/lighthouse/audits/http-redirects-to-https).
@psyked
psyked / upload.js
Created May 15, 2017 20:49
Uploading a file to Trello API with Node.js
'use strict'
const fs = require('fs')
const path = require('path')
const Trello = require('node-trello')
const trelloAuth = JSON.parse(fs.readFileSync('trello-credentials.json', 'utf8'))
const t = new Trello(trelloAuth.key, trelloAuth.token)
t.post(`/1/cards/${card.id}/attachments`, {
const ExifImage = require('exif').ExifImage;
new ExifImage({ image: './input-file.jpg' }, function (error, exifData) {
if (error) throw error;
const { gps } = exifData;
console.log(gps);
}
{
"GPSLatitudeRef": "N",
"GPSLatitude": [ 52, 39, 15.8 ],
"GPSLongitudeRef": "W",
"GPSLongitude": [ 0, 30, 20.45 ],
"GPSAltitudeRef": 0,
"GPSAltitude": 62.632075471698116,
"GPSTimeStamp": [ 19, 21, 42 ],
"GPSSpeedRef": "K",
"GPSSpeed": 0,