Skip to content

Instantly share code, notes, and snippets.

View daliborgogic's full-sized avatar
:octocat:
In Git we trust!

Dalibor Gogic daliborgogic

:octocat:
In Git we trust!
View GitHub Profile
@daliborgogic
daliborgogic / apply.js
Last active September 28, 2018 20:02
const separator = (height = 12, color = '#e0e0e0') =>
`<tr><td height="${height}"></td></tr>
<tr><td height="${height}" style="border-top: 1px solid ${color};"></td></tr>`
const space = x => `<tr><td height="${x}"></td></tr>`
const label = x => `<tr><td style="font-size: 12px; color: #999;">${x}</td></tr>`
const input = x => `<tr><td style="font-size: 16px;">${x}</td></tr>`
const check = (a, b) => { return a ? label(b) + input(a) + separator() : '' }
const footer = `<tr>
<td style="font-size: 12px; color: #999999;">
<b>NAME</b><br>
@daliborgogic
daliborgogic / InputTypeFile.vue
Last active October 6, 2023 13:03
Input type file component with drag and drop (Vue.js)
<template>
<div ref="div">
<label>
<strong v-if="progress === 0">
{{ label }}
<svg width="24" height="24" viewBox="0 0 24 24"><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/><path d="M0 0h24v24H0z" fill="none"/></svg>
</strong>
<strong v-if="progress > 0 && progress < 100"> {{ progress }}%</strong>
<span v-else>{{ name }}</span>
<input ref="input" type="file" :accept="accept" @change="onFileChange"/>
@daliborgogic
daliborgogic / cart.vue
Last active September 22, 2018 19:07
<template lang="pug">
svg(viewBox="0 0 119 20" version="1.1" xmlns="http://www.w3.org/2000/svg")
rect(v-for="p, index in om" width="1" :height="p === 0 ? 1 : p" :key="index" :x="index * 2" :y="p === 0 ? 19 : 20 - p" fill="#999")
</template>
<script>
export default {
data () {
return {
@daliborgogic
daliborgogic / workers.js
Last active September 18, 2018 15:52
Web Workers Example
const marked = require('marked')
self.onmessage = function (event) {
switch (event.data) {
case 'next':
next(event.data)
break
case 'license':
license(event.data)
break
@daliborgogic
daliborgogic / Dockerfile
Last active September 15, 2018 17:35
DevOops Multi Stage Build
FROM mhart/alpine-node:10.10.0 as full
WORKDIR /app
ENV HOST 0.0.0.0
COPY . .
RUN npm ci
RUN npm run build
RUN rm -rf node_modules
# Magic!
RUN npm ci nuxt-start-edge debug --production
@daliborgogic
daliborgogic / .dockerignore
Last active December 22, 2019 08:16
Mnml Nuxt.js Docker ~57.5MB
*
!assets
!pages
!static
!nuxt.config.js
!package*.json
@babel
@csstools
@nuxtjs
@vue
@webassemblyjs
@xtuc
accepts
acorn
acorn-dynamic-import
ajv
@daliborgogic
daliborgogic / Content.vue
Last active November 6, 2019 12:35
Mark external links (UX). internal let router handle.
<template>
<div v-html="content" />
</template>
<script>
export default {
props: {
content: {
type: String,
default: ''
@daliborgogic
daliborgogic / H1.vue
Last active September 11, 2018 11:37
<template lang="pug">
h1(v-html="content")
</template>
<script>
export default {
props: {
content: {
type: String,
default: ''