Skip to content

Instantly share code, notes, and snippets.

View codepo8's full-sized avatar

Christian Heilmann codepo8

View GitHub Profile
@codepo8
codepo8 / firefoxdetect.js
Created June 19, 2012 17:04
Detecting Firefox and thanking users
(function(){
var messages = {
'Firefox': ''+
'<h2>Thanks for using Firefox!</h2>'+
'<img src="http://misfitgeek.com/images/firefox3.jpeg" alt="Firefox">',
'FirefoxAndroid': ''+
'<h2>Thanks for using Firefox for Android!</h2>'+
'<img src="http://misfitgeek.com/images/fennec-icon.jpeg" '+
@codepo8
codepo8 / gUM_hack.html
Created September 28, 2012 21:54 — forked from anantn/gUM_hack.html
Example getUserMedia Usage
<!DOCTYPE html public "✰">
<html>
<head>
<meta charset="utf-8">
<title>getUserMedia Video Example</title>
</head>
<body>
<button type="button" onclick="toggle()">
Toggle Video
</button>
@codepo8
codepo8 / dabblet.css
Created November 8, 2012 10:07
Untitled
body {
background: #fff;
margin:0;
}
section{
display: block;
width: 550px;
position:relative;
overflow: hidden;
}
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
button {
width: 100%;
height: 100px;
}
@codepo8
codepo8 / canvas-helper-tools.js
Last active December 17, 2015 15:29
Two handy helper routines for canvas work
// Get the canvas and the context
var c = document.querySelector('canvas');
var cx = c.getContext('2d');
// pixelcolour returns an object of rgba for the pixel at x and y
// great for checking if you are in a certain boundary or for
// colourpickers
function pixelcolour(x, y) {
var pixels = cx.getImageData(0, 0, c.width, c.height);
var index = ((y * (pixels.width * 4)) + (x * 4));
@codepo8
codepo8 / redirect
Last active June 29, 2021 16:58
Simple redirect of hotlinked images in .htaccess
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
# allowed domains, add as needed
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?google.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?christianheilmann.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?wait-till-i.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?mozilla.org [NC]
# search engines and social sites and stuff
#!/bin/sh
# requires youtube-dl https://rg3.github.io/youtube-dl/
ids=(lJ1kY-CSpBk znwWYR1mzzw 6evp7YLDJrg cRTko6m6U4A 6Qx5ZAbfqjo 4dwZ-WIJCSo YuezRMnwyeI xzBloghQhO4 2ypYniQa7_o oUVT1HXlnls PA139CERNbc 1sLjWlWvCsc d0pOgY8__JM c5GlZp6L9P4 zvG97aOfAJM VxxTkhSTJbA rw8Q9ZLDkEs rw8Q9ZLDkEs 5mcyUUf20Ng Mju-k0yxLnk 6FRURtW5qXI 2sZsBf-oUj8 ltMCrW9JCEE VHbnuNng0M8 aQSz4KnSFvk biJXpv-6XVY Sq4havIoQOo 9oGQucDOaoY SmE4OwHztCc Ju8x3z1LuCg pKtG4dO-9Tw EEF2DlOUkag MptY6ff4tOQ 18s7jJEJeOc c9kkqSgxqxQ raJcug_vW0c sloddfX9jLE 3fNEkYJIXhc CzxQn78uO6c UqSQbS7rltU fuXuirjR5NM UcPCAYpgB7k GPce5lNUhtc 4Qs5mqa4ioU BRbcoXq_x2M Xvdnewmdokc zKLkHbcjwsc 57fth5EZl8E 2BdFg5JT9lg ani_MOZt5_c)
for i in "${ids[@]}"
do
youtube-dl "https://www.youtube.com/watch?v="$i
done
<p class="tweetthis">
<a href="http://twitter.com/share?url=<?php urlencode(the_permalink());?>&amp;text=<?php echo ( get_the_title());?>&amp;via=codepo8"
target="blank">
<svg class="svg-icon" viewBox="0 0 20 20">
<path fill="none" d="M14.467,6.707c-0.34,0.198-0.715,0.342-1.115,0.419c-0.318-0.335-0.775-0.545-1.279-0.545c-0.969,0-1.754,0.773-1.754,1.727c0,0.135,0.015,0.267,0.045,0.394C8.905,8.628,7.612,7.94,6.747,6.896C6.596,7.151,6.509,7.448,6.509,7.764c0,0.599,0.31,1.128,0.78,1.438C7.002,9.192,6.732,9.115,6.495,8.985c0,0.007,0,0.014,0,0.021c0,0.837,0.605,1.535,1.408,1.694c-0.147,0.04-0.302,0.06-0.462,0.06c-0.113,0-0.223-0.011-0.33-0.031c0.223,0.687,0.871,1.186,1.638,1.199c-0.6,0.464-1.356,0.739-2.179,0.739c-0.142,0-0.281-0.007-0.418-0.023c0.777,0.489,1.699,0.775,2.689,0.775c3.228,0,4.991-2.63,4.991-4.913c0-0.075-0.002-0.149-0.004-0.223c0.342-0.244,0.639-0.547,0.875-0.894c-0.316,0.137-0.652,0.23-1.008,0.272C14.057,7.448,14.336,7.11,14.467,6.707 M10,0.594c-5.195,0-9.406,4.211-9.406,9.406c0,5.195
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Audio archive</title>
<style>
body {
font-family: helvetica,arial,sans-serif;
color: #333;
@codepo8
codepo8 / names.json
Created April 19, 2017 22:19
MST3K names of the "Space Mutiny" episode
[
'Beat PunchBeef',
'Big, Brave Brick of Meat',
'Big McLargeHuge',
'Blast HardCheese',
'Blast ThickNeck',
'Bob Johnson',
'Bold BigFlank',
'Bolt VanderHuge',
'Brick HardMeat',