Skip to content

Instantly share code, notes, and snippets.

View jonasdk's full-sized avatar

Jonas Krat jonasdk

View GitHub Profile
@jonasdk
jonasdk / vcl_deliver.vcl
Created March 11, 2019 09:56 — forked from tgwizard/vcl_deliver.vcl
Fastly VCL config for A/B tests
sub vcl_deliver {
# ----- snip -----
# Set a cookie with the experiment group sequence, if the client didn't
# already have the cookie and provided it in the request, and if the origin
# hasn't already set it. Use `setcookie.get_value_by_name` to handle the
# cases when the backend sets multiple cookies.
# Only do this on the edge nodes, not the origin shield, otherwise the edge
# nodes will see a response with a `Set-Cookie` header and not cache it.
@jonasdk
jonasdk / README.md
Created April 11, 2018 13:57 — forked from cben/README.md
svg>switch>foreignObject>img fallback in email

From what I read known SVG->PNG fallbacks don't work well in email:
http://stylecampaign.com/blog/2014/01/basics-of-svg-in-email/
http://emailcodegeek.com/svg-images/
http://mikevoermans.com/css/svg-png-fallback-html-email

But then I stumbled upon this 2009 technique: http://www.kaizou.org/2009/03/inline-svg-fallback/ and it works surprisingly well!

Caveat: apparently it only works when the svg contains no text; any text content might be visible (in addition to the fallback) in clients that don't understand svg.

@jonasdk
jonasdk / README.md
Created April 11, 2018 13:50 — forked from cben/README.md
testing mathml->image fallback in email

Test mail1.html

Tested 2 fallback ways inside semantics tag:

  1. <annotation-xml encoding="MathML-Presentation"><mtext><img ... (the math was display="block")
  2. <annotation-xml encoding="text/html"><img ... (the math was inline)

Didn't try altimg fallbacks, nor <annotation encoding="image/png" src=...> as I figure it's unlikely any clients that don't understand MathML would honor them. img can be honored simply by skipping all the unfamiliar tags.

I tried to use xmlns in a way that (hopefully) would work both in HTML5 and older parsers...

@jonasdk
jonasdk / css-media-queries-cheat-sheet.css
Created September 7, 2017 20:35 — forked from bartholomej/css-media-queries-cheat-sheet.css
CSS Media Query Cheat Sheet (with Foundation)
/*------------------------------------------
Responsive Grid Media Queries - 1280, 1024, 768, 480
1280-1024 - desktop (default grid)
1024-768 - tablet landscape
768-480 - tablet
480-less - phone landscape & smaller
--------------------------------------------*/
@media all and (min-width: 1024px) and (max-width: 1280px) { }
@media all and (min-width: 768px) and (max-width: 1024px) { }
@jonasdk
jonasdk / inputTypeNumberPolyfill.js
Created June 24, 2016 11:51 — forked from nbouvrette/inputTypeNumberPolyfill.js
Stand alone JavaScript polyfill allow only numbers on input of type number.
/**
* Stand alone polyfill allow only numbers on input of type number.
*
* While input filtering is already supported by default by some browsers, maximum length has not been implemented by
* any. This script will solve both issue and make sure that only digits can be entered in input elements of type
* number. If the optional attribute `max` is set, it will calculate it's length and mimic the `maxlength` behavior on
* input of type text.
*
* Supports:
*
@jonasdk
jonasdk / phoenix showdown rackspace onmetal io.md
Created April 28, 2016 07:25 — forked from omnibs/phoenix showdown rackspace onmetal io.md
Phoenix Showdown Comparative Benchmarks @ Rackspace

Comparative Benchmark Numbers @ Rackspace

I've taken the benchmarks from Matthew Rothenberg's phoenix-showdown, updated Phoenix to 0.13.1 and ran the tests on the most powerful machines available at Rackspace.

Results

Framework Throughput (req/s) Latency (ms) Consistency (σ ms)
@jonasdk
jonasdk / logstach Examples
Created April 12, 2016 11:14 — forked from bugcy013/logstach Examples
logstach Examples collection
Example -1
=====================
input {
file {
path => [ "/usr/local/var/log/suricata/eve.json", "/var/log/ulogd.json" ]
codec => json
type => "json-log"
}
}
@jonasdk
jonasdk / README.md
Created April 7, 2016 06:42 — forked from oodavid/README.md
Backup MySQL to Amazon S3

Backup MySQL to Amazon S3

This is a simple way to backup your MySQL tables to Amazon S3 for a nightly backup - this is all to be done on your server :-)

Sister Document - Restore MySQL from Amazon S3 - read that next

1 - Install s3cmd

this is for Centos 5.6, see http://s3tools.org/repositories for other systems like ubuntu etc

————————————————————————————————————————————————————————————————————————————————————————————————————
BBEDIT/TEXTWRANGLER REGULAR EXPRESSION GUIDE MODIFIED 2014-01-13 : 00:12
————————————————————————————————————————————————————————————————————————————————————————————————————
NOTES:
The PCRE engine (Perl Compatible Regular Expressions) is what BBEdit and TextWrangler use.
Items I'm unsure of are marked '# PCRE?'. The list while fairly comprehensive is not complete.
@jonasdk
jonasdk / README.md
Last active August 29, 2015 14:07 — forked from addyosmani/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