This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Original idea: https://github.com/necolas/normalize.css/tree/master | |
* Added box-sizing based on https://css-tricks.com/box-sizing/ | |
**/ | |
/** | |
* 1. Correct the line height in all browsers. | |
* 2. Prevent adjustments of font size after orientation changes in iOS. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require("path") | |
module.exports = { | |
/* Your site config here */ | |
siteMetadata: { | |
title: "Generic Site Title", | |
}, | |
pathPrefix: `/gby1`, | |
plugins: [ | |
`gatsby-transformer-sharp`, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const simple = { | |
method: (param) => { | |
return `my param: ${param}` | |
} | |
}; | |
export const shorter = { | |
method(param1) { | |
return `my param1: ${param1}` | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const {assign} = Object; | |
const pipe = (fn, ...fns) => (param, ...staticArgs) => fns.reduce((acc, f) => f(acc), fn(param, ...staticArgs)); | |
const compose = (...fns) => pipe(...fns.reverse()); | |
const pipeAsync = (fn, ...fns) => (param, ...staticArgs) => fns.reduce((acc, f) => acc.then(_ => f(_, ...staticArgs)), fn(param, ...staticArgs)); | |
const composeAsync = (...fns) => pipeAsync(...fns.reverse()); | |
const apply = (...fns) => (...args) => fns.map(fn => fn(...args)); | |
const curry = (fn, ...args) => (fn.length <= args.length) ? fn(...args) : (...more) => curry(fn, ...args, ...more); | |
const match = (guard) => (left = _ => _, right = _ => _) => (...args) => (..._) => guard(...args) ? right(..._, ...args) : left(..._, ...args); | |
const extract = (_) => (...methods) => methods.reduce((acc, method) => assign(acc, {[method]: (...args) => _[method](...args)}), {}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const asc = (left, right) => left < right ? -1 : left > right ? 1 : 0; | |
const desc = (left, right) => left > right ? -1 : left < right ? 1 : 0; | |
const sort = (array, column, order) => array.sort(({[column]: left}, {[column]: right}) => order(left, right)); | |
export const sortAsc = (array, column) => sort(array, column, asc); | |
export const sortDesc = (array, column) => sort(array, column, desc); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
Task will run through /src/html/ folder and will loop through each html file | |
When it finds {{head}}, it will be replaced with a content from /src/inc/head.html | |
Example of src/inc/breadcrumb.html | |
<ul> | |
<li><a href="link/page">Home</a></li> | |
<li>{{content}}</li> | |
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
const subClassExample = { | |
Person: function(firstName, lastName) { | |
this.firstName = firstName; | |
this.lastName = lastName; | |
this.gender = 'male'; | |
} | |
} | |
const clark = new subClassExample.Person('Clark', 'Kent'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.addEventListener("load", function () { | |
console.warn('------------------- EAGLE LANDED -------------------') | |
let arr = Array.from(document.getElementsByTagName('a')); | |
console.warn('A TAGS', arr.length); | |
arr.forEach(function (a) { | |
a.addEventListener('click', function (e) { | |
console.warn('CLICK ELEM', e.target); | |
e.preventDefault(); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
"use strict"; | |
var ticking = false; | |
window.addEventListener('scroll', function () { | |
if (!ticking) { | |
window.requestAnimationFrame(function () { | |
runYourMethod(); | |
ticking = false; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gulp.task('update-content-file', function () { | |
"use strict"; | |
var fs = fs || require('fs'); | |
var path = 'path/to/folder'; | |
// example of CSS path change and adding new css | |
var oldContent = /<link href="(.*)dev\/css\/main.css" rel="stylesheet">/; | |
var newContent = '<link href="/dev/css/main.css" rel="stylesheet"><link href="/dev/css/specific.css" rel="stylesheet">'; | |
fs.readdir(path, function(err, files) { |
NewerOlder