This file contains hidden or 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
import metalsmith from 'metalsmith'; | |
import markdown from 'metalsmith-markdown'; | |
import robots from './metalsmith-robots.js'; | |
metalsmith(__dirname) | |
.use(markdown()) | |
.use(robots({ | |
source: 'sample-robots.txt' | |
}) | |
.destination('./build'); |
This file contains hidden or 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 getContent(selector) { | |
var html = document.querySelector(selector).innerHTML; | |
return html.replace(/<[^>]*>/g, ""); | |
} |
This file contains hidden or 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
// In-place merge b to a | |
let a = ['foo', 'bar'], | |
b = ['baz', 'foobar', 'foobaz']; | |
a.push(...b); | |
console.log('a with ES6 sexiness', a); | |
// or the old way | |
[].push.apply(a, b); | |
console.log('a with apply', a) |
This file contains hidden or 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
module.exports = function() { | |
let now = new Date().getTime(); | |
let loadTime = now - performance.timing.navigationStart; | |
console.log("User-perceived page loading time: " + loadTime); | |
return loadTime; | |
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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 nodeList = document.getElementsByTag('a') | |
// Nothing else to it! | |
[].forEach.call(nodeList, e => { | |
e.addEventListener('click', controller) | |
}) | |
// or | |
for (const el of document.querySelectorAll('.tippy-popper')) { | |
el.addEventListener('click', slickAsF) |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<link rel="icon" type="image/x-icon" href="/favicon.ico"> | |
<style id="_outline-styles"> | |
/* Outline styles will be injected here */ | |
</style> | |
</head> |
This file contains hidden or 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
import './carousel.scss'; | |
var _forEach = require('lodash').forEach; | |
import {lory} from 'lory.js'; // get lory | |
export class Carousel { | |
constructor(settings = {}) { | |
var timer = this._timer = 0; | |
var paused = this._paused = false; | |
var speed = this._speed = 5000; |
This file contains hidden or 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
# Just so I'd remember how to add files that you forgot to a local commit | |
# Maybe one day I'll learn... x_x | |
# edited file-that-i-remember.txt | |
git add file-that-i-remember.txt | |
git commit | |
# realize you forgot a file | |
git add file-that-i-forgot.txt | |
git commit --amend --no-edit |