Skip to content

Instantly share code, notes, and snippets.

@ghooghe
ghooghe / docker-cli.sh
Created August 10, 2016 12:19
Docker commands
docker pull <imagename>
docker ps -a
docker logs -f
docker stop/start <containerid/name>
docker exec -it <containerid/name> bash
docker rm <containerid>
docker rmi <imageid>
-d detached mode
-P expose ports
@ghooghe
ghooghe / letsencrypt.yourdomain.conf
Created December 18, 2015 14:10 — forked from nwgat/letsencrypt.yourdomain.conf
lighttpd letsencrypt ssl conf
$SERVER["socket"] == ":443" {
ssl.engine = "enable"
ssl.pemfile = "/etc/letsencrypt/live/yourdomain/ssl.pem"
ssl.ca-file = "/etc/letsencrypt/live/yourdomain/fullchain.pem"
ssl.dh-file = "/etc/ssl/certs/dhparam.pem"
ssl.ec-curve = "secp384r1"
ssl.honor-cipher-order = "enable"
ssl.cipher-list = "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH"
ssl.use-compression = "disable"
setenv.add-response-header = (
@ghooghe
ghooghe / loadicons.html
Created September 23, 2015 18:28 — forked from scottjehl/loadicons.html
load the icons
<head>
...
...
<script>
// async-load a stylesheet full of data-uri'd icons...
(function( href ){
links = document.getElementsByTagName( "link" ),
elem = document.createElement( "link" ),
ref = links[ links.length ];
@ghooghe
ghooghe / noncritcss.md
Created September 23, 2015 18:27 — forked from scottjehl/noncritcss.md
Comparing two ways to load non-critical CSS

I wanted to figure out the fastest way to load non-critical CSS so that the impact on initial page drawing is minimal.

TL;DR: Here's the solution I ended up with: https://github.com/filamentgroup/loadCSS/


For async JavaScript file requests, we have the async attribute to make this easy, but CSS file requests have no similar standard mechanism (at least, none that will still apply the CSS after loading - here are some async CSS loading conditions that do apply when CSS is inapplicable to media: https://gist.github.com/igrigorik/2935269#file-notes-md ).

Seems there are a couple ways to load and apply a CSS file in a non-blocking manner:

@ghooghe
ghooghe / anchorinclude.js
Created September 23, 2015 18:25 — forked from scottjehl/anchorinclude.js
Anchor-include Pattern
/*
* anchor-include pattern for already-functional links that work as a client-side include
* Copyright 2011, Scott Jehl, scottjehl.com
* Dual licensed under the MIT
* Idea from Scott Gonzalez
* to use, place attributes on an already-functional anchor pointing to content
* that should either replace, or insert before or after that anchor
* after the page has loaded
* Replace: <a href="..." data-replace="articles/latest/fragment">Latest Articles</a>
* Before: <a href="..." data-before="articles/latest/fragment">Latest Articles</a>
@ghooghe
ghooghe / fluid-image.css
Created February 13, 2014 10:06
Css fluid image (responsive)
img {
max-width: 100%;
height: auto;
}
@ghooghe
ghooghe / image-replacement.css
Created February 13, 2014 10:05
Css image replacement
.hide-text {
text-indent: 100%;
white-space: nowrap;
overflow: hidden;
}
@ghooghe
ghooghe / clearfix.css
Last active August 29, 2015 13:56
Css Clear fix without extra markup (ie8+)
/**
* 1. The space content is one way to avoid an Opera bug when the
* contenteditable attribute is included anywhere else in the document.
* Otherwise it causes space to appear at the top and bottom of elements
* that are clearfixed.
* 2. The use of `table` rather than `block` is only necessary if using
* `:before` to contain the top-margins of child elements.
*/
.cf:before,
.cf:after {
@ghooghe
ghooghe / mime-message-to-eml.java
Created December 2, 2013 13:14
Write MimeMessage to .eml file
File eml = File.createTempFile("mailservice-output", ".eml");
OutputStream out = new FileOutputStream(eml);
msg.writeTo(out);
logger.debug("Temporary e-mail file written to {}", eml.getAbsolutePath());
IOUtils.closeQuietly(out);
/*! normalize.css v2.1.3 | MIT License | git.io/normalize */article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,video{display:inline-block}audio:not([controls]){display:none;height:0}[hidden],template{display:none}html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}a{background:transparent}a:focus{outline:thin dotted}a:active,a:hover{outline:0}h1{font-size:2em;margin:.67em 0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}dfn{font-style:italic}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}mark{background:#ff0;color:#000}code,kbd,pre,samp{font-family:monospace,serif;font-size:1em}pre{white-space:pre-wrap}q{quotes:"\201C" "\201D" "\2018" "\2019"}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:0}fieldset{border:1px solid silver;margin:0