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
// http://stackoverflow.com/questions/10964966/detect-ie-version-prior-to-v9-in-javascript | |
// http://tanalin.com/en/articles/ie-version-js/ | |
var ie = (function (){ | |
if (window.ActiveXObject === undefined) return null; | |
if (!document.querySelector) return 7; | |
if (!document.addEventListener) return 8; | |
if (!window.atob) return 9; | |
if (!document.__proto__) return 10; | |
return 11; | |
})(); |
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
// Given a integer n, output the first n numbers of the Fibonacci sequence efficiently. | |
// Input: 5 | |
// Output: [1, 1, 2, 3, 5] | |
function fib(n) { | |
if (n < 2) { | |
return 1; | |
} | |
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
var gulp = require('gulp'); | |
var del = require('del'); | |
var runSequence = require('run-sequence'); | |
// var minifyHTML = require('gulp-minify-html'); | |
var minifyInline = require('gulp-minify-inline'); | |
var size = require('gulp-size'); | |
var uglify = require('gulp-uglify'); | |
var htmlmin = require('gulp-htmlmin'); | |
var options = { |
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
// Via route property. | |
this.set('route.path', '/the/new/path') | |
// Or to change the full absolute url: | |
window.history.pushState({}, null, '/the/new/absolute/path'); | |
this.fire('location-changed', {node: window}); |
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
// https://github.com/robbyrussell/oh-my-zsh | |
// https://github.com/wesbos/Cobalt2-iterm |
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
// http://stackoverflow.com/questions/5189560/squash-my-last-x-commits-together-using-git | |
# Reset the current branch to the commit just before the last 12: | |
git reset --hard HEAD~12 | |
# HEAD@{1} is where the branch was just before the previous command. | |
# This command sets the state of the index to be as it would just | |
# after a merge from that commit: | |
git merge --squash HEAD@{1} | |
# Commit those squashed changes. The commit message will be helpfully |
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
// https://help.github.com/articles/configuring-a-remote-for-a-fork/ | |
// https://github.com/Kunena/Kunena-Forum/wiki/Create-a-new-branch-with-git-and-manage-branches | |
// List current configured remote repo for your fork. | |
git remote -v | |
// Specify a new remote upstream repo. | |
git remote add upstream <GITHUB_REPO_URL> | |
// https://help.github.com/articles/syncing-a-fork/ |
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
brew install node --with-intl=full-icu --download-all | |
// To reinstall with all locales. | |
brew reinstall node --with-full-icu |
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 a = document.createElement('div'); | |
document.body.appendChild(a); | |
const b = document.createElement('template'); | |
b.innerHTML = ` | |
<style> | |
:host { display: block; box-sizing: border-box; } | |
.container { background-color: var(--fancy-bg, red); | |
@media (min-width: 768px) { |
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
_trapFocusWithinModal (ev, focusableNodes, callback) { | |
const _kc = ev.keyCode; | |
if (ev.type === 'keydown' && _kc === TAB_KEY) { | |
console.log('keyboard tab on:', ev.target, focusableNodes); | |
// Prevent default TAB operation. | |
ev.preventDefault(); | |
const _maxAllowableFocusableNodesLength = focusableNodes.length - 1; |