Skip to content

Instantly share code, notes, and snippets.

@herrernst
herrernst / retina.html
Created September 9, 2011 11:45
Retina Images with CSS content
<!doctype html>
<title>Retina Images with CSS content</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<style>
@media all and (-webkit-device-pixel-ratio: 1.5) {
/* e. g. android hi res devices
see: http://developer.android.com/guide/webapps/targeting.html#DensityCSS
*/
#people9 { content: url(//lorempixum.com/300/225/people/9/); }
@herrernst
herrernst / js-find.js
Created December 18, 2013 15:47
javascript find in array with .reduce
//quick and dirty, does not consider all function params and this yet
Array.prototype.find = function (predicate) {
return this.reduce(function(prev, cur){return predicate(cur) ? cur : prev })
}
@herrernst
herrernst / .fonts.conf
Created July 25, 2016 09:20 — forked from anonymous/.fonts.conf
Reduce hinting amount for fonts on linux
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM '/etc/fonts/fonts.dtd'>
<fontconfig>
<match target="font">
<edit name="hintstyle" mode="assign">
<const>hintslight</const>
</edit>
</match>
</fontconfig>
@herrernst
herrernst / grayramp.html
Last active October 6, 2016 19:29
draw grayscale ramp with html/css
<!doctype html>
<title>draw grayscale ramp</title>
<meta name="viewport" content="width=device-width">
<style>
.ramp {
height: 300px;
position: relative;
}
.ramp > div {
position: absolute;
<!doctype html>
<title>gradient gray alpha</title>
<meta name="viewport" content="width=device-width">
<style>
.gradient {
width: 768px;
height: 300px;
background-image: linear-gradient(to right, rgba(0, 0, 0, 0.5), rgb(128, 128, 128));
}
</style>
@herrernst
herrernst / Dockerfile
Created December 20, 2016 22:19
Dockerfile to build librespot on Ubuntu Precise
FROM ubuntu:precise
RUN echo -n "foreign-architecture armhf" > /etc/dpkg/dpkg.cfg.d/multiarch
RUN sed -i 's/deb /deb [arch=amd64,i386] /g' /etc/apt/sources.list
RUN sed -i 's/deb-src /#deb-src /g' /etc/apt/sources.list
RUN echo "deb [arch=armhf] http://ports.ubuntu.com/ precise main" >> /etc/apt/sources.list
RUN echo "deb [arch=armhf] http://ports.ubuntu.com/ precise-security main" >> /etc/apt/sources.list
RUN echo "deb [arch=armhf] http://ports.ubuntu.com/ precise-updates main" >> /etc/apt/sources.list
RUN apt-get update
RUN apt-get install -y gcc-arm-linux-gnueabihf libasound2:armhf libasound2-dev:armhf portaudio19-dev:armhf
RUN apt-get install -y gcc g++ git curl pkg-config libprotoc-dev file make
@herrernst
herrernst / Dockerfile
Last active December 20, 2016 22:54
Dockerfile to build librespot on Ubuntu Trusty
FROM ubuntu:trusty
RUN dpkg --add-architecture armhf
RUN sed -i 's/deb /deb [arch=amd64,i386] /g' /etc/apt/sources.list
RUN sed -i 's/deb-src /#deb-src /g' /etc/apt/sources.list
RUN echo "deb [arch=armhf] http://ports.ubuntu.com/ trusty main" >> /etc/apt/sources.list
RUN echo "deb [arch=armhf] http://ports.ubuntu.com/ trusty-security main" >> /etc/apt/sources.list
RUN echo "deb [arch=armhf] http://ports.ubuntu.com/ trusty-updates main" >> /etc/apt/sources.list
RUN apt-get -y update
RUN apt-get install -y gcc-arm-linux-gnueabihf libasound2:armhf libasound2-dev:armhf
RUN apt-get install -y gcc g++ git curl pkg-config libprotoc-dev file
@herrernst
herrernst / browser-standby.md
Last active February 3, 2017 05:36
Browser behavior on computer standby

Windows 10, Ethernet DHCP

IE11

offline/online events: yes

expired timers: fire immediately

active timers: fire on time

Firefox 50

@herrernst
herrernst / web-embed.html
Last active August 29, 2017 14:50
Web embeds
<!doctype html>
<title>Web embeds</title>
<h2>Youtube</h2>
<iframe width="560" height="315" src="https://www.youtube.com/embed/dQw4w9WgXcQ" frameborder="0" allowfullscreen></iframe>
<h2>Twitter</h2>
<blockquote class="twitter-tweet" data-cards="hidden" data-lang="en"><p lang="en" dir="ltr">&quot;No one is born hating another person because of the color of his skin or his background or his religion...&quot; <a href="https://t.co/InZ58zkoAm">pic.twitter.com/InZ58zkoAm</a></p>&mdash; Barack Obama (@BarackObama) <a href="https://twitter.com/BarackObama/status/896523232098078720">August 13, 2017</a></blockquote>
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>
@herrernst
herrernst / touchmove-prevent.html
Created September 6, 2017 12:15
safari touchmove event preventDefault
<!doctype html>
<meta name="viewport" content="initial-scale=1">
<h1>safari touchmove event preventDefault</h1>
<div style="width: 300px; height: 300px; background: green"></div>
<h2>works</h2>
<pre>
document.addEventListener("touchmove", (e) => e.preventDefault())
</pre>
<h2>works</h2>
<pre>