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
let a = async (x = '') => await (await fetch(`https://api.github.com${x}`)).json()
await a()
// {
// "current_user_url": "/user",
await a('/user')
// "authorizations_url": "/authorizations",
// "code_search_url": "/search/code?q={query}{&page,per_page,sort,order}",
// "commit_search_url": "/search/commits?q={query}{&page,per_page,sort,order}",
// "emails_url": "/user/emails",
// "emojis_url": "/emojis",
@daliborgogic
daliborgogic / token.js
Last active December 10, 2018 19:32
JWT module
const jwt = require('jsonwebtoken')
const { readFileSync } = require('fs')
const private = readFileSync(__dirname + '/private.pem')
const public = readFileSync(__dirname + '/public.pem')
const {
ISSUER = 'DevOops',
SUBJECT = '[email protected]',
AUDIENCE = 'https://devoops.app'
@daliborgogic
daliborgogic / index.html
Last active December 1, 2018 21:16
Line numbers with CSS only
<pre>
<span>module.exports = async (req, res) => {</span>
<span> return</span>
<span>}</span>
</pre>

SOON does not imply any particular date, time, decade, century, or millennia in the past, present, and certainly not the future. SOON shall make no contract or warranty between DevOops and the end user. SOON will arrive some day, DevOops does guarantee that SOON will be here before the end of time. Maybe. Do not make plans based on SOON as DevOops will not be liable for any misuse, use, or even casual glancing at SOON.

VERY SOON is guaranteed to arrive between now and the end of time with a higher chance of arriving on the NOW half of the time table. Although this means closer to now than SOON and there is no guarantee that you will live long enough to see the content finally release.

Generally use words such as OUTLOOK, WILL, COULD, WOULD, MIGHT, REMAINS, TO BE, PLANS, BELIEVES, MAY, EXPECTS, INTENDS, ANTICIPATES, ESTIMATE, FUTURE, PLAN, POSITIONED, POTENTIAL, PROJECT, REMAIN, SCHEDULED, SET TO, SUBJECT TO, UPCOMING and similar.

const ukupno = (cena = 0, kolicina = 1, pdv = 20) => {
const format = (cena * kolicina / 100)
const saPDV = format + (pdv / 100 * format)
return saPDV.toLocaleString('sr-RS', {
minimumFractionDigits: 2,
maximumFractionDigits: 2
})
}
@daliborgogic
daliborgogic / App.vue
Last active November 2, 2020 07:07
Variable Fonts Vue.js
<template>
<div id="app" :style="cssVariables">
<label>wdth</label>
<input type="range" min="10" max="700" v-model="wght">
<label>wght</label>
<input type="range" min="10" max="100" v-model="wdth">
<span>The quick brown fox jumps over the lazy dog</span>
</div>
</template>
@daliborgogic
daliborgogic / bash.sh
Created October 10, 2018 11:17
npm permission fix
$ sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}
$ npm i -g whatever
@daliborgogic
daliborgogic / Docekrfile
Created October 7, 2018 11:26
Docker s3cmd
FROM mhart/alpine-node:10.10.0
WORKDIR /app
COPY . .
RUN apk update && \
apk add --no-cache python py-pip py-setuptools git ca-certificates && \
git clone https://github.com/s3tools/s3cmd.git /tmp/s3cmd && \
cd /tmp/s3cmd && \
python setup.py install && \
apk del git && \
@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"/>