Skip to content

Instantly share code, notes, and snippets.

View grgur's full-sized avatar
☀️
Sunny side up

Grgur Grisogono grgur

☀️
Sunny side up
View GitHub Profile
@grgur
grgur / vue3.code-snippets
Created October 6, 2020 11:36
Vue 3 code snippets for VS Code
{
"Vue SFC": {
"prefix": "sfc",
"scope": "vue",
"body": [
"<template>",
"\t${1}",
"</template>",
"",
"<script>",
@grgur
grgur / slow-resources.js
Created September 13, 2019 11:28
List slow-loading resources (√ Chrome + √ Firefox; Safari partial)
// 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);
/*!
* 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 December 22, 2016 21:02 — 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/
# 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 September 12, 2015 22:11
Demo of async/await with ES6 generators
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);
# ---------------------------------------------------------------------------
#
# 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 July 16, 2012 09:21
IntelliJ IDEA/WebStorm/AnyOtherStorm code style
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 July 13, 2011 17:25 — forked from eligrey/gist:1079572
BlobBuilder shim
/* 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 June 28, 2011 10:25 — forked from greenido/IndexDB-demo3.html
IndexDB demo for MDC day (Chrome 12+ and FF4+)
<!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;