View [component].vue
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
<template> | |
<UCard v-if="component" class="relative flex flex-col lg:h-[calc(100vh-10rem)]" body-class="px-4 py-5 sm:p-6 relative" footer-class="flex flex-col flex-1 overflow-hidden"> | |
<div class="flex justify-center"> | |
<component :is="`U${defaultProps[params.component].component.name}`" v-if="defaultProps[params.component] && defaultProps[params.component].component" v-bind="defaultProps[params.component].component.props" /> | |
<component :is="is" v-bind="{ ...boundProps, ...eventProps }"> | |
<template v-for="[key, slot] of Object.entries(defaultProps[params.component]?.slots || {}) || []" #[key]> | |
<template v-if="Array.isArray(slot)"> | |
<div :key="key"> | |
<component |
View timeago.vue
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
<template> | |
<time :datetime="date" :title="date">{{ timeago }}</time> | |
</template> | |
<script> | |
const units = [ | |
{ max: 2760000, value: 60000, name: 'minute', short: 'm', past: 'a minute ago', future: 'in a minute' }, | |
{ max: 72000000, value: 3600000, name: 'hour', short: 'h', past: 'an hour ago', future: 'in an hour' }, | |
{ max: 518400000, value: 86400000, name: 'day', short: 'd', past: 'yesterday', future: 'tomorrow' }, | |
{ max: 2419200000, value: 604800000, name: 'week', short: 'w', past: 'last week', future: 'in a week' }, |
View keybindings.json
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
[ | |
{ | |
"key": "ctrl+shift+n", | |
"command": "workbench.action.terminal.new" | |
}, | |
{ | |
"key": "ctrl+shift+right", | |
"command": "workbench.action.terminal.focusNext" | |
}, | |
{ |
View login-url
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/login/oauth/authorize?client_id=55440d3936ba0961241e |
View workshop-token
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
?access_token=5f73077695f6d2b1d5d0ae4f2277919639838932 |
View async-foreach.js
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 waitFor = (ms) => new Promise(r => setTimeout(r, ms)) | |
const asyncForEach = async (array, callback) => { | |
for (let index = 0; index < array.length; index++) { | |
await callback(array[index], index, array) | |
} | |
} | |
const start = async () => { | |
await asyncForEach([1, 2, 3], async (num) => { | |
await waitFor(50) |
View last-digit-ean13.js
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 getLastEan13Digit(ean) { | |
if (!ean || ean.length !== 12) throw new Error('Invalid EAN 13, should have 12 digits') | |
const multiply = [1, 3] | |
let total = 0 | |
ean.split('').forEach((letter, index) => { | |
total += parseInt(letter, 10) * multiply[index % 2] | |
}) |
View forEach.proto.js
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
Array.prototype.forEach = function (callback) { | |
// this represents our array | |
for (let index = 0; index < this.length; i++) { | |
// We call the callback for each entry | |
callback(this[index], index, this) | |
} | |
} |
View forEach.js
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 waitFor = (ms) => new Promise((resolve) => setTimeout(resolve, (ms || 0))) | |
[1, 2, 3].forEach(async (num) => { | |
await waitFor(50) | |
console.log(num) | |
}) | |
console.log('Done') |
View index.vue
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
<template> | |
<div> | |
<h1>Welcome!</h1> | |
<nuxt-link to="/about">About page</nuxt-link> | |
<img :src="flagUrl"/> | |
<button @click="nextFlag">Next flag</button> | |
</div> | |
</template> | |
<script> |
NewerOlder