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 / cities.csv
Created August 15, 2017 18:01 — forked from d3noob/.block
World map with zoom / pan and cities
code city country lat lon
ZNZ ZANZIBAR TANZANIA -6.13 39.31
TYO TOKYO JAPAN 35.68 139.76
AKL AUCKLAND NEW ZEALAND -36.85 174.78
BKK BANGKOK THAILAND 13.75 100.48
DEL DELHI INDIA 29.01 77.38
SIN SINGAPORE SINGAPOR 1.36 103.75
BSB BRASILIA BRAZIL -15.67 -47.43
RIO RIO DE JANEIRO BRAZIL -22.90 -43.24
YTO TORONTO CANADA 43.64 -79.40

Hair

Value Group 1
1 Thin
2
3
4 Full
@daliborgogic
daliborgogic / server.js
Last active August 5, 2017 22:08
Node.js Push Stream
// https://github.com/nodejs/node/blob/master/doc/api/http2.md
const fs = require('fs')
const http2 = require('http2')
const options = {
key: fs.readFileSync('privkey.pem'),
cert: fs.readFileSync('cert.pem')
}
const server = http2.createSecureServer(options)
npm i

cat > .env << EOL
CONTENTFUL_SPACE=
CONTENTFUL_DELIVERY_ACCESS_TOKEN=
CONTENTFUL_PREVIEW_ACCESS_TOKEN=
CONTENTFUL_INITIAL_SYNC=true
EOL
dlbr@lnx:~/dev/dlbr-pwa$ npm outdated
Package Current Wanted Latest Location
contentful 4.5.0 4.5.2 4.5.0 dlbr-pwa
dlbr@lnx:~/dev/dlbr-pwa$ npx npm-check -u
npx: installed 218 in 5.926s
❤️ Your modules look amazing. Keep up the great work. ❤️
dlbr@lnx:~/dev/dlbr-pwa$ npm update
+ contentful@4.5.2
added 120 packages and updated 4 packages in 4.263s
@daliborgogic
daliborgogic / index.js
Created July 24, 2017 16:56
Get, set, delete cookie
const setCookie = (name, value, days = 7, path = '/') => {
const expires = new Date(Date.now() + days * 864e5).toUTCString()
document.cookie = `${name}=${encodeURIComponent(value)}; expires=${expires}; path=${path}`
}
const getCookie = name => {
return document.cookie.split('; ').reduce((r, v) => {
const parts = v.split('=')
return parts[0] === name ? decodeURIComponent(parts[1]) : r
}, '')
const CACHE_NAME = '$$$toolbox-cache$$$http://localhost:5000/$$$'
function linkIsAvailableOffline (links) {
links.forEach(link => {
const HREF = link.getAttribute('href')
caches.open(CACHE_NAME).then(cache => {
cache.match(HREF).then(response => {
link.setAttribute('data-offline', response ? true : false)
})
@daliborgogic
daliborgogic / Icon-Settings.vue
Created July 18, 2017 19:47
Using ARIA to enhance SVG accessibility
<template lang="pug">
svg.icon.icon-settings(
fill="#000000"
height="24"
viewBox="0 0 24 24"
width="24"
xmlns="http://www.w3.org/2000/svg"
role="img"
aria-labelledby="iconSettingsTitle iconSettingsDescription"
)
window.addEventListener('load', () => {
const t = performance.timing
// Log performance details:
for (const key of [
'fetchStart',
'connectStart',
'connectEnd',
'requestStart',
'responseStart',
'responseEnd',
@daliborgogic
daliborgogic / Icons.vue
Last active June 26, 2017 12:35
SVG sprite Vue.js component
<!-- set pug as language, jade is only for gist sintax highlight -->
<template lang="jade">
- var background = 'path(d="M0 0h24v24H0z" fill="none")'
svg(height="0" width="0" style="position:absolute; margin-left: -100%;")
//- If your shape consist of many small chunks, you’ll need to wrap them all with a g tag and add an ID to that group.
g#check-box-outline
#{background}
path(d="M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z")
g#check-box
#{background}