Skip to content

Instantly share code, notes, and snippets.

View MathieuLoutre's full-sized avatar

Mathieu Triay MathieuLoutre

View GitHub Profile

Keybase proof

I hereby claim:

  • I am mathieuloutre on github.
  • I am mathieuloutre (https://keybase.io/mathieuloutre) on keybase.
  • I have a public key ASA1ga7hgDfAmgn3XqUK_t1M8Gy5wLKksNiHrFauKDKesQo

To claim this, I am signing this object:

@MathieuLoutre
MathieuLoutre / formatAddress.js
Last active December 9, 2018 11:13
Using OpenCageData address formatting with Node.js
const fs = require('fs')
const yaml = require('js-yaml')
const Mustache = require('mustache')
const addressFormats = yaml.safeLoad(fs.readFileSync('./worldwide.yaml', 'utf8'))
const first = function () {
return (text, render) => render(text, this).split(/\s*\|\|\s*/).find((el) => el)
}
@MathieuLoutre
MathieuLoutre / .eslintrc
Created August 15, 2018 11:31
ESLint Boilerplate
{
"parser": "babel-eslint",
"env": {
"browser": true,
"node": true,
"es6": true
},
"globals": {
"document": true,
"window": true,
<html>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=9">
<head>
<title>OTVar Test: Marvin Visions</title>
<style>
@font-face {
font-family: "MarvinVisions";
src: url(MarvinVisionsGX.ttf);
@MathieuLoutre
MathieuLoutre / book-titles.txt
Created August 10, 2017 21:23
Book titles and authors generated from Penguin Classics data using Torch RNN
The Penguin Book of Recano by John Charles
The Decifestes by Erandius Baule
The Complete Short Stories by Alexander Khanine
The Complete Stories by John Benchelle
The Story of the Father Saisian by Alexander Lewell
The Penguin Book of the Artist by Charlos Pote Dingerette
The Book of Gunk by Arne Galder
The Prince of Sherlock Sagas by Alenard de Susara
The Last Bather by James Cassemi
The Search of a Charles of Sime of Frederick Holmes by Giang Franco
@MathieuLoutre
MathieuLoutre / index.js
Created March 1, 2017 18:06
Basic Geo Targeting
$.getJSON("http://geoip.nekudo.com/api?callback=?", function (res) {
if (res.country && res.country.code === "GB") {
$("#retailer-links").html("<li><a href='https://www.amazon.co.uk/'>Amazon</a></li><li><a href='https://www.waterstones.com/'>Waterstones</a></li>")
}
})
@MathieuLoutre
MathieuLoutre / gist:6886442
Created October 8, 2013 15:23
Merge two JS objects
function merge (obj, source) {
for (prop in source) {
if (typeof source[prop] === 'object' && typeof obj[prop] === 'object') {
merge(obj[prop], source[prop])
}
else {
if (obj[prop] === void 0) {
obj[prop] = source[prop]
}
}
@MathieuLoutre
MathieuLoutre / Gruntfile.js
Created August 22, 2013 08:14
Compress + AWS S3 upload
grunt.initConfig({
aws: grunt.file.readJSON('aws-keys.json'), // Read the file
compress: {
assets: {
options: {
mode: 'gzip'
},
},
files: [