Skip to content

Instantly share code, notes, and snippets.

View anselmh's full-sized avatar

Anselm Hannemann anselmh

View GitHub Profile
@bkastl
bkastl / comparison
Last active December 17, 2015 04:49
JPEG Encoder comparison (lena 56KB filesize goal)
Original file:
Lena.png 512 x 512 Pixel 24 bit Color 386.301 Byte
The standard for image compression tests.
Might be highly optimized in some encoders.
Goal: Get the most quality out of around 56KB.
Look at http://benediktkastl.de/summary_lena.htm for the images.
Metrics explained:
@sergejmueller
sergejmueller / .htaccess
Last active October 9, 2024 00:33
Apache: Detecting WebP support with Header Vary Accept
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_ACCEPT} image/webp
RewriteCond %{DOCUMENT_ROOT}/$1.webp -f
RewriteRule (.+)\.(jpe?g|png)$ $1.webp [T=image/webp,E=accept:1]
</IfModule>
<IfModule mod_headers.c>
Header append Vary Accept env=REDIRECT_accept
</IfModule>
@ddemaree
ddemaree / _retina.scss
Created April 26, 2013 20:49
Example Sass mixin for a "bulletproof" Hi-DPI media query
@mixin retina($ratio: 1.5) {
$dpi: $ratio * 96;
$opera-ratio: $ratio * 100;
@media only screen and (-webkit-min-device-pixel-ratio: #{$ratio}),
only screen and ( -o-min-device-pixel-ratio: '#{$opera-ratio}/100'),
only screen and ( min-resolution: #{$dpi}dpi),
only screen and ( min-resolution: #{$ratio}dppx) {
@content;
}
@lilith
lilith / unified-picture.md
Last active December 14, 2015 06:59
Unified solution to <picture> element

On Feb. 6th, I published a proposal for a simplified <picture> design, in order to make the element accessible to end-users. After mailing list dicussion, the community was asked for a unified solution that doesn't sacrifice any functionality or performance present in original design.

Without breaking compatibility or usability of the current <picture> design, I believe the that we can also support a simplified, declarative model that focuses on use case 3.1, and is easier for end-users and content management systems to suppport. I introduced the unified proposal on Feb. 27th 2013 via the public-html-comments mailing list, and also notified respimg.

In lieu of duplicating all content from [my original proposal](https://gist.github.com/n

@SlexAxton
SlexAxton / .zshrc
Last active June 6, 2025 19:18
My gif workflow
gifify() {
if [[ -n "$1" ]]; then
if [[ $2 == '--good' ]]; then
ffmpeg -i $1 -r 10 -vcodec png out-static-%05d.png
time convert -verbose +dither -layers Optimize -resize 600x600\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > $1.gif
rm out-static*.png
else
ffmpeg -i $1 -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif
fi
else
@darobin
darobin / index.html
Last active December 12, 2015 07:48
Who needs srcset? Who needs <picture>? Not the AppCache people we don't!
<!DOCTYPE html>
<!--
- controllerpath should default to /*, it's just the typical thing
- controllersync ensures the controller is always there
-->
<html controller="respimg.js" controllerpath="/*" controllersync>
<!-- ... -->
<img src='my-shiny-donkey.png#resp-me'>
</html>
@drublic
drublic / Default (OSX).sublime-keymap
Last active October 10, 2015 15:07
My Sublime Text 2 Settings
[
{ "keys": ["ctrl+alt+f"], "command": "use_it" },
{ "keys": ["ctrl+tab"], "command": "prev_view_in_stack" },
{ "keys": ["ctrl+shift+tab"], "command": "next_view_in_stack" },
{ "keys": ["ctrl+shift+j"], "command": "js_run" },
// Paste and indent
{ "keys": ["super+v"], "command": "paste_and_indent" },
@paulirish
paulirish / gist:3098860
Created July 12, 2012 15:26
Open Conference Expectations

Open Conference Expectations

This document lays out some baseline expectations between conference speakers and conference presenters. The general goal is to maximize the value the conference provides to its attendees and community and to let speakers know what they might reasonably expect from a conference.

We believe that all speakers should reasonably expect these things, not just speakers who are known to draw large crowds, because no one is a rockstar but more people should have the chance to be one. We believe that conferences are better -- and, dare we say, more diverse -- when the people speaking are not just the people who can afford to get themselves there, either because their company paid or they foot the bill themselves. Basically, this isn't a rock show rider, it's some ideas that should help get the voices of lesser known folks heard.

These expectations should serve as a starting point for discussion between speaker and organizer. They are not a list of demands; they are a list of rea

@asciidisco
asciidisco / iot.md
Created July 4, 2012 15:53
Image optimization tools (losless)

I want your lossless image optimization tool knowlegde:

Note: I´am looking for cmd tools (preferred running on mac/linux/win - but it´s not a must) Online services are welcome as well. If you have a good article, stackoverflow post or smth. else on image optimization (with statistics & stuff), i would appriciate if you could share that, too.

Already suggested:

@christianhanvey
christianhanvey / convertMarkdown.php
Created June 21, 2012 13:20
convert from Markdown to HTML - MODX custom output filter
<?php
/* convertMarkdown - a custom output filter
* by Christian Hanvey
* WTFPL License
*
* ORIGINAL PHP MARKDOWN CLASS by Michel Fortin
* http://michelf.com/projects/php-markdown/
*
*