Skip to content

Instantly share code, notes, and snippets.

View Jezfx's full-sized avatar
✌️

jez Jezfx

✌️
View GitHub Profile
const webpack = require('webpack');
const nodeEnv = process.env.NODE_ENV || 'production';
module.exports = {
devtool: 'source-map',
entry: {
filename: './app.js'
},
output: {
filename: '_build/bundle.js'
@Jezfx
Jezfx / slugify
Created February 2, 2017 12:31
slugify strings
export function slugify(text) {
return text.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/\-\-+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of text
}
@Jezfx
Jezfx / easings
Created March 6, 2017 11:11
Cubic Bezier easings for smooth animations
/*SINE*/
$easeInSine: cubic-bezier(0.47, 0, 0.745, 0.715);
$easeOutSine: cubic-bezier(0.39, 0.575, 0.565, 1);
$easeInOutSine: cubic-bezier(0.445, 0.05, 0.55, 0.95);
/*QUAD*/
$easeInQuad: cubic-bezier(0.55, 0.085, 0.68, 0.53);
$easeOutQuad: cubic-bezier(0.25, 0.46, 0.45, 0.94);
$easeInOutQuad: cubic-bezier(0.455, 0.03, 0.515, 0.955);
@Jezfx
Jezfx / colour-system.scss
Last active September 19, 2017 13:22
colour map system
// a good way to get by having `.grey-light` `.grey-lighter` variable names
$colour-map-grey: (
1000: hsl(0, 0%, 10%), // #1A1A1A
1500: hsl(0, 0%, 14%), // #232323
2000: hsl(0, 0%, 20%), // #333333
2500: hsl(0, 0%, 33%), // #545454
3000: hsl(0, 0%, 40%), // #6e6e6e
5000: hsl(0, 0%, 80%), // #cccccc
7000: hsl(0, 0%, 96%), // #eeeeee
@Jezfx
Jezfx / z-indexes.scss
Created September 19, 2017 13:21
z-index map system
///* ========================================================================
// #Z-INDEX
// ======================================================================== */
$z-index-map: (
'far-background': -20,
'background': -10,
'middle': 0,
'forground': 10,
'near-foreground': 20
Spaceport - http://spaceportx.com
Escalator - http://theescalator.com
Hello Hub - http://hellowork.co.uk
The Assembly - http://assemblymcr.com
MadLab - http://madlab.org.uk
Metro Desk - http://metrodesk.com
Work Space - http://work-space.co.uk
Colony Co - http://colonyco.work
@Jezfx
Jezfx / es6.md
Last active October 23, 2017 16:14
hotshot ES6 snippets 🔥 (js)

1) Find an index

Get a single post from an array of objects

const i = this.props.posts.findIndex((post) => post.code === postId);
const post = this.props.posts[i];

2) Switch two variables around

Use destructuring to re-assign two variables

@Jezfx
Jezfx / libraries.md
Last active April 27, 2018 16:19
Collection of useful libraries
@Jezfx
Jezfx / resouces.md
Last active March 14, 2018 13:58
mentors and resources 👨‍💻 (js)
@Jezfx
Jezfx / es6.md
Last active October 26, 2017 15:17
Learnings 📙 (es6, eslint)

ES6

Things I've learnt from Wesbos.com course

Scoping

var variables can be updated or mutated, which means you can re-delare a var again.

var variables are function scope. Which means their only available inside the function that they were created. Or, global scope if they've been created outside a function.

const and let are block scope which means they are confined inside any block, even if statements.