Skip to content

Instantly share code, notes, and snippets.

View Mika-'s full-sized avatar

Mika Simanainen Mika-

View GitHub Profile
@Mika-
Mika- / google-analytics.amp.html
Created October 18, 2015 10:34
Use Google Analytics in AMP HTML
<amp-pixel src="https://ssl.google-analytics.com/collect?v=1&amp;tid=UA-12345678-1&amp;t=pageview&amp;cid=$RANDOM&amp;dt=$TITLE&amp;dl=$CANONICAL_URL&amp;z=$RANDOM"></amp-pixel>
/*
* Required parameters:
* v = API version number (currently 1)
* tid = Google Analytics property identifier (UA-12345678-1)
* t = hit type
* cid = client id (you should implement this via cookie etc.)
* z = random string to bypass caching (amphtml generates this to $RANDOM variable)
@Mika-
Mika- / favicon.bat
Created June 17, 2015 18:07
Create a multi resolution favicon with imagemagick
convert logo.png -background transparent -resize 64x64 -gravity center -extent 64x64 ^
( -clone 0 -resize 48x48 ) ^
( -clone 0 -resize 32x32 ) ^
( -clone 0 -resize 16x16 ) ^
-colors 256 -alpha background favicon.ico
@Mika-
Mika- / gist:185c8d777aab3ebba548
Created February 11, 2015 15:26
Resize and convert image to web optimized jpg with imagemagick and mozjpeg
convert source.png -resize 1920x1080 -background white -flatten TGA:- | cjpeg -quality 90 -targa -outfile compressed.jpg