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
export default (value) => { | |
return ('00' + value).slice(String(value).length); | |
} |
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
#!/bin/bash | |
# Print string in an X | |
for ((i=${#1}-1; i>=0; i--)); do | |
printf "%$((${#1}-i+1))s\\r%b%s\\n" \ | |
"${1:$((max-i-1)):1}" "\\033[$((i+1))C" "${1:$i:1}" | |
done |
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
/* | |
A date formatter filter for SSGs/templating languages | |
*/ | |
module.exports = (date) => { | |
const month = [ | |
"January", | |
"February", | |
"March", | |
"April", | |
"May", |
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 = { | |
100: 'Continue', | |
101: 'Switching Protocols', | |
200: 'Success', | |
201: 'Created', | |
202: 'Accepted', | |
203: 'Non-Authoritative Information', | |
204: 'No Content', | |
205: 'Reset Content', | |
206: 'Partial Content', |
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 http = require('http') | |
const https = require('https') | |
const url = require('url') | |
module.exports = { | |
urlCheck, | |
request | |
} | |
function urlCheck(url) { |
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
/* Remember to add styles for the .caps class */ | |
.caps { | |
font-size: 1.4em; | |
} |
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
// The polling function | |
function poll(fn, condition) { | |
const endTime = Number(new Date()) + timeout | |
const checkCondition = (resolve, reject) => fn() | |
.then(response => { | |
if (condition(response)) { | |
resolve(response) | |
} else if (Number(new Date()) < endTime) { | |
// Condition isn't met but the timeout hasn't elapsed, go again | |
setTimeout(checkCondition, interval, resolve, reject) |
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 *pollForWeatherInfo(){ | |
while (true) { | |
yield fetch('/api/currentWeather', { | |
method: 'get' | |
}).then(res => res.json()) | |
} | |
} | |
function runPolling(generator){ | |
if (!generator) { |
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
<template> | |
<div class="dropdown-wrapper" :class="{ open }"> | |
<a class="dropdown-title" @click="toggle"> | |
<span class="title">{{ item.text }}</span> | |
<span class="arrow" :class="open ? 'down' : 'right'"></span> | |
</a> | |
<DropdownTransition> | |
<ul class="nav-dropdown" v-show="open"> | |
<li | |
class="dropdown-item" |
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 nprogress from 'nprogress' | |
export default { | |
// ... | |
// configure progress bar | |
nprogress.configure({ showSpinner: false }) | |
this.$router.beforeEach((to, from, next) => { | |
if (to.path !== from.path && !Vue.component(pathToComponentName(to.path))) { |