Skip to content

Instantly share code, notes, and snippets.

View andreasvirkus's full-sized avatar
🙊
made you look

andreas andreasvirkus

🙊
made you look
View GitHub Profile
@andreasvirkus
andreasvirkus / common.conf
Last active January 3, 2019 15:14
Just an Nginx configuration
# Config to disallow the browser to render the page inside an iframe
# and avoid clickjacking http://en.wikipedia.org/wiki/Clickjacking
# if you need to allow [i]frames, you can use SAMEORIGIN or even set an uri with ALLOW-FROM uri
# https://developer.mozilla.org/en-US/docs/HTTP/X-Frame-Options
add_header X-Frame-Options SAMEORIGIN;
# don't send the nginx version number in error pages and Server header
server_tokens off;
# when serving user-supplied content, include a X-Content-Type-Options: nosniff header along with the Content-Type: header,
@andreasvirkus
andreasvirkus / cash.jquery.js
Created August 15, 2017 14:48
Cash.js script that also pretends to be jQuery (for those stubborn jQuery plugins)
"use strict";/*! cash-dom 1.3.0, https://github.com/kenwheeler/cash @license MIT */
!function(t,n){"function"==typeof define&&define.amd?define(n):"undefined"!=typeof exports?module.exports=n():t.cash=t.$=n()}(this,function(){function t(t,n){n=n||w;var e=k.test(t)?n.getElementsByClassName(t.slice(1)):F.test(t)?n.getElementsByTagName(t):n.querySelectorAll(t);return e}function n(t){return E=E||w.createDocumentFragment(),A=A||E.appendChild(w.createElement("div")),A.innerHTML=t,A.childNodes}function e(t){"loading"!==w.readyState?t():w.addEventListener("DOMContentLoaded",t)}function r(r,i){if(!r)return this;if(r.cash&&r!==T)return r;var o,u=r,s=0;if(q(r))u=$.test(r)?w.getElementById(r.slice(1)):D.test(r)?n(r):t(r,i);else if(R(r))return e(r),this;if(!u)return this;if(u.nodeType||u===T)this[0]=u,this.length=1;else for(o=this.length=u.length;o>s;s++)this[s]=u[s];return this}function i(t,n){return new r(t,n)}function o(t,n){for(var e=t.length,r=0;e>r&&n.call(t[r],t[r],r,t)!==!1;r++);}function u(t,n){var e=t&&(t.matche
.fade-gradient {
position: fixed;
top: 100px;
height: 100px;
width: 100%;
background-image: url(gradient.png);
margin: 0;
left: 0;
}
/**
* VueRouter's scrollBehavior for scrolling to anchor links
*
* TODO: Swap TweenLite maybe for my custom jump.s snippet or jump.js lib (10kB vs 0.4kB vs 1.3kB)
* https://github.com/callmecavs/jump.js
*/
export default new Router({
mode: 'history',
scrollBehavior(to, from, savedPosition) {
if (to.hash) {
# Just so I'd remember how to add files that you forgot to a local commit
# Maybe one day I'll learn... x_x
# edited file-that-i-remember.txt
git add file-that-i-remember.txt
git commit
# realize you forgot a file
git add file-that-i-forgot.txt
git commit --amend --no-edit
import './carousel.scss';
var _forEach = require('lodash').forEach;
import {lory} from 'lory.js'; // get lory
export class Carousel {
constructor(settings = {}) {
var timer = this._timer = 0;
var paused = this._paused = false;
var speed = this._speed = 5000;
@andreasvirkus
andreasvirkus / outlineStyles.html
Created August 7, 2017 11:01
The proper way to get rid of outline styles _aesthetically_, whilst keeping them for accessibility purposes!
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="/favicon.ico">
<style id="_outline-styles">
/* Outline styles will be injected here */
</style>
</head>
/**
* Highlight navigation by subheading and update navbar/page url with section hash
*
* NOTE: Taken raw from Docker docs.
* TODO: Refactor to vanilla JS and ES6
*/
function highlightRightNav(heading) {
if (document.location.pathname.indexOf("/glossary/")<0){
console.log("highlightRightNav called on",document.location.pathname)
if (heading == "title")
const nodeList = document.getElementsByTag('a')
// Nothing else to it!
[].forEach.call(nodeList, e => {
e.addEventListener('click', controller)
})
// or
for (const el of document.querySelectorAll('.tippy-popper')) {
el.addEventListener('click', slickAsF)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.