Skip to content

Instantly share code, notes, and snippets.

Avatar
☀️
Enjoy life!

Grgur Grisogono grgur

☀️
Enjoy life!
View GitHub Profile
@grgur
grgur / vue3.code-snippets
Created Oct 6, 2020
Vue 3 code snippets for VS Code
View vue3.code-snippets
{
"Vue SFC": {
"prefix": "sfc",
"scope": "vue",
"body": [
"<template>",
"\t${1}",
"</template>",
"",
"<script>",
@grgur
grgur / slow-resources.js
Created Sep 13, 2019
List slow-loading resources (√ Chrome + √ Firefox; Safari partial)
View slow-resources.js
// Anything over this threshold is considered slow
const THRESHOLD = 600; // 600 ms
// User-friendly number rounding
function round(value) {
if (!this.format) {
this.intl = new Intl.NumberFormat(navigator.language, {
maximumFractionDigits: 2,
});
this.format = this.intl.format.bind(this.intl);
View JavaScript preload() function
/*!
* JavaScript preload() function
* Preload images, CSS and JavaScript files without executing them
* Script by Stoyan Stefanov – http://www.phpied.com/preload-cssjavascript-without-execution/
* Slightly rewritten by Mathias Bynens – http://mathiasbynens.be/
* Demo: http://mathiasbynens.be/demo/javascript-preload
*/
function preload(arr) {
var i = arr.length,
@grgur
grgur / nginx.conf
Created Dec 22, 2016 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
View nginx.conf
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@grgur
grgur / async-generator.js
Last active Sep 12, 2015
Demo of async/await with ES6 generators
View async-generator.js
function makeRequest(url) {
fetch(url)
.then(response => response.json())
.then(json => it.next(json))
.catch(error => console.error('Somthing shit the bed', error));
}
function *syncRequests() {
const redditUrl = 'https://www.reddit.com/controversial.json?count=1&limit=2';
const page1 = yield makeRequest(redditUrl);
View .bash_profile
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
@grgur
grgur / JS-IDE-Code-Style.txt
Created Jul 16, 2012
IntelliJ IDEA/WebStorm/AnyOtherStorm code style
View JS-IDE-Code-Style.txt
Code Style -> JavaScript -> Spaces
All default +
√ Before parentheses -> Function declaration parentheses
Code Style -> JavaScript -> Other
Align object properties: On colon
Code Style -> CSS -> Other
Align values: On colon
@grgur
grgur / BlobBuilder.js
Created Jul 13, 2011 — forked from eligrey/gist:1079572
BlobBuilder shim
View BlobBuilder.js
/* BlobBuilder.js
* A complete BlobBuilder shim
* By Eli Grey
* License: MIT/X11
*/
/*global self, unescape, encodeURIComponent */
/*jslint bitwise: true, regexp: true, confusion: true, es5: true, vars: true, white: true,
plusplus: true, maxerr: 50, indent: 4 */
@grgur
grgur / IndexDB-demo3.html
Created Jun 28, 2011 — forked from greenido/IndexDB-demo3.html
IndexDB demo for MDC day (Chrome 12+ and FF4+)
View IndexDB-demo3.html
<!DOCTYPE html>
<html>
<head>
<title>IndexDB Demo - Version 1.0</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="author" content="Ido Green"/>
</head>
<style>
#footer {
background-color: yellowgreen;