Skip to content

Instantly share code, notes, and snippets.

View DWboutin's full-sized avatar
🎯
Focusing

Mike Boutin DWboutin

🎯
Focusing
  • Quebec city
View GitHub Profile
@DWboutin
DWboutin / allowCrossOriginMiddleware.js
Created July 15, 2016 19:05
Express cross-origin options
export default function allowCrossOrigin(req, res, next) {
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS');
res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept');
if ('OPTIONS' === req.method) {
res.sendStatus(200);
} else {
next();
}
ZIPCODE: {
GB: /^GIR[ ]?0AA|((AB|AL|B|BA|BB|BD|BH|BL|BN|BR|BS|BT|CA|CB|CF|CH|CM|CO|CR|CT|CV|CW|DA|DD|DE|DG|DH|DL|DN|DT|DY|E|EC|EH|EN|EX|FK|FY|G|GL|GY|GU|HA|HD|HG|HP|HR|HS|HU|HX|IG|IM|IP|IV|JE|KA|KT|KW|KY|L|LA|LD|LE|LL|LN|LS|LU|M|ME|MK|ML|N|NE|NG|NN|NP|NR|NW|OL|OX|PA|PE|PH|PL|PO|PR|RG|RH|RM|S|SA|SE|SG|SK|SL|SM|SN|SO|SP|SR|SS|ST|SW|SY|TA|TD|TF|TN|TQ|TR|TS|TW|UB|W|WA|WC|WD|WF|WN|WR|WS|WV|YO|ZE)(\d[\dA-Z]?[ ]?\d[ABD-HJLN-UW-Z]{2}))|BFPO[ ]?\d{1,4}$/i,
JE: /^JE\d[\dA-Z]?[ ]?\d[ABD-HJLN-UW-Z]{2}$/i,
GG: /^GY\d[\dA-Z]?[ ]?\d[ABD-HJLN-UW-Z]{2}$/i,
IM: /^IM\d[\dA-Z]?[ ]?\d[ABD-HJLN-UW-Z]{2}$/i,
US: /^\d{5}([ \-]\d{4})?$/i,
CA: /^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJ-NPRSTV-Z]\s?\d[ABCEGHJ-NPRSTV-Z]\d$/gi,
DE: /^\d{5}$/i,
JP: /^\d{3}-\d{4}$/i,
FR: /^\d{2}[ ]?\d{3}$/i,
v8.10.0
5.6.0
[email protected] /Users/mikaelboutin/Desktop/novalabs/novalab-react
├─┬ @zeit/[email protected]
│ ├─┬ @zeit/[email protected]
│ │ ├─┬ [email protected]
│ │ │ ├── [email protected] deduped
│ │ │ ├─┬ [email protected]
│ │ │ │ ├── [email protected]
│ │ │ │ ├── [email protected]
{
"name": "nextjs-redux-bootstrap",
"version": "0.0.1",
"description": "",
"main": "index.js",
"scripts": {
"test": "NODE_ENV=test mocha \"tests/**/*.{js,jsx}\" --require mocha-snapshots --require ignore-styles --no-deprecation --reporter list --compilers js:babel-core/register --recursive",
"test-coverage": "NODE_ENV=test nyc --reporter=text mocha \"tests/**/*.{js,jsx}\" --recursive --reporter list --compilers js:babel-core/register --require mocha-snapshots --require ignore-styles",
"dev": "node server.js",
"build": "next build ./src",
@DWboutin
DWboutin / SCSS.md
Created July 11, 2018 18:33 — forked from jareware/SCSS.md
Advanced SCSS, or, 16 cool things you may not have known your stylesheets could do

⇐ back to the gist-blog at jrw.fi

Advanced SCSS

Or, 16 cool things you may not have known your stylesheets could do. I'd rather have kept it to a nice round number like 10, but they just kept coming. Sorry.

I've been using SCSS/SASS for most of my styling work since 2009, and I'm a huge fan of Compass (by the great @chriseppstein). It really helped many of us through the darkest cross-browser crap. Even though browsers are increasingly playing nice with CSS, another problem has become very topical: managing the complexity in stylesheets as our in-browser apps get larger and larger. SCSS is an indispensable tool for dealing with this.

This isn't an introduction to the language by a long shot; many things probably won't make sense unless you have some SCSS under your belt already. That said, if you're not yet comfy with the basics, check out the aweso

@DWboutin
DWboutin / app_filters.py
Created August 23, 2018 14:48
Django filter to keep only wanted HTML tags
from django import template
from django.utils.html import format_html
from django.template.defaultfilters import stringfilter
register = template.Library()
@register.filter(name='keeptags')
@stringfilter
def keeptags(value, tags):
"""
@DWboutin
DWboutin / app_filters.py
Created August 23, 2018 14:49
Django filter to transform HTML to a string with tags replaced by white spaces
from django import template
from django.utils.html import format_html
from django.template.defaultfilters import stringfilter
register = template.Library()
@register.filter(name='convert_tags_to_space')
@stringfilter
def convert_tags_to_space(value):
import re
import mockAxios from 'axios'
import AxiosClient from '../../src/Clients/AxiosClient'
describe('AxiosClient', () => {
test('calls axios.create on new instance', done => {
new AxiosClient({})
expect(mockAxios.create).toBeCalled()
done()
@DWboutin
DWboutin / no-zoom.css
Created March 15, 2019 14:00
Remove zoom on IOS input focus
@media screen and (-webkit-min-device-pixel-ratio:0) {
input[type="email"]:hover,
input[type="number"]:hover,
input[type="search"]:hover,
input[type="text"]:hover,
input[type="tel"]:hover,
input[type="url"]:hover,
input[type="password"]:hover,
textarea:hover,
select:hover{font-size: initial;}
@DWboutin
DWboutin / directUploadToS3.js
Created March 31, 2019 22:33
Direct image url to S3 wiht axios and nodejs
import AWS from 'aws-sdk';
import stream from 'stream'
import axios from 'axios';
export default async (url, filename, callback) => {
const s3 = new AWS.S3({ params: { Bucket: process.env.STATIC_MAPS_BUCKET }});
let contentType = 'application/octet-stream'
let promise = null
const uploadStream = () => {