Skip to content

Instantly share code, notes, and snippets.

🔥
In case of fire: git commit, git push, leave the building!

Dalibor Gogic daliborgogic

🔥
In case of fire: git commit, git push, leave the building!
Block or report user

Report or block daliborgogic

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View nuxt-netlify-http2-server-push-module.js
// https://www.netlify.com/blog/2017/07/18/http/2-server-push-on-netlify/
const debug = require('debug')('nuxt:netlify-http2-server-push');
const path = require('path');
const glob = require('glob');
const fs = require('fs');
module.exports = function module(moduleOptions) {
// This module is only enabled on production builds
if (this.options.dev) {
@addyosmani
addyosmani / workbox.md
Last active Oct 16, 2019
Workbox recipes
View workbox.md

Workbox runtime caching recipes

Your Service Worker script will need to import in Workbox and initialize it before calling any of the routes documented in this write-up, similar to the below:

importScripts('workbox-sw.prod.v1.3.0.js');
const workbox = new WorkboxSW();

// Placeholder array populated automatically by workboxBuild.injectManifest()
@JamieMason
JamieMason / README.md
Last active Feb 25, 2019
Access deeply nested value in JavaScript
View README.md

Access deeply nested value in JavaScript

Loose Version

const complete = {
  foo: {
    bar: {
      baz: 'hello'
    }
View Postman.desktop
[Desktop Entry]
Encoding=UTF-8
Name=Postman
Exec=postman
Icon=/opt/Postman/resources/app/assets/icon.png
Terminal=false
Type=Application
Categories=Development;
@daliborgogic
daliborgogic / delay.js
Created Dec 16, 2016
Node.js Async/Await delay
View delay.js
'use strict'
const timeout = ms => new Promise(res => setTimeout(res, ms))
function convinceMe (convince) {
let unixTime = Math.round(+new Date() / 1000)
console.log(`Delay ${convince} at ${unixTime}`)
}
async function delay () {
@joshcanhelp
joshcanhelp / scrollTo.js
Last active Feb 10, 2019
Animated scrollTo for specific element or top of page
View scrollTo.js
//
// Smooth scroll-to inspired by:
// http://stackoverflow.com/a/24559613/728480
//
module.exports = function (scrollTo, scrollDuration) {
//
// Set a default for where we're scrolling to
//
@yunghoy
yunghoy / gist:a425f91824d26461bb2e3653bc56ebbf
Last active Oct 3, 2019
AMQP library (RabbitMQ) - async/await
View gist:a425f91824d26461bb2e3653bc56ebbf
alias babel-node='babel-node --presets stage-0'
------ RECV ------
// babel-node recv2.js "#"
// babel-node recv2.js "kern.*"
const amqp = require('amqplib');
const args = process.argv.slice(2);
if (args.length == 0) {
View IE CSS Hacks All - IE6, 7, 8, 9, 10, 11, Edge
" Make IE Better Compatible "
<!--[if IE]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
======================================================
IE6 Only
==================
_selector {...}
@BinaryMuse
BinaryMuse / restful.js
Last active Mar 17, 2019
Express API with Async/Await
View restful.js
import express from "express";
/**
* Takes a route handling function and returns a function
* that wraps it after first checking that the strings in
* `reserved` are not part of `req.body`. Used for ensuring
* create and update requests do not overwrite server-generated
* values.
*/
function checkReservedParams(routeHandler, ...reserved) {
@addyosmani
addyosmani / README.md
Last active Oct 17, 2019 — forked from 140bytes/LICENSE.txt
108 byte CSS Layout Debugger
View README.md

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version

You can’t perform that action at this time.