Skip to content

Instantly share code, notes, and snippets.

View codepunkt's full-sized avatar

Christoph Werner codepunkt

View GitHub Profile
@codepunkt
codepunkt / index.html
Last active December 11, 2015 11:48
Delay DOMContentLoaded. NodeJS server using connect to deliver 25s delayed css.
<!doctype html5>
<html>
<head>
<style>
#box { height: 250px; -webkit-transition: all 5s; -moz-transition: all 5s; }
</style>
<script>
window.addEventListener('DOMContentLoaded', function() {
console.log('DOMContentLoaded!');
}, false);
@codepunkt
codepunkt / rm-corrupt.sh
Created November 19, 2012 16:48
find/delete corrupt whisper-files
#!/bin/bash
options=('find' 'delete')
PS3='state your wish: '
echo -e "\nfind/delete corrupt whisper-files"
select opt in "${options[@]}"; do
case $REPLY in
[12] ) option=$opt; break;;
* ) exit;;
@codepunkt
codepunkt / dabblet.css
Created September 28, 2012 13:33
Opera Bug (SVG Data URI background, border-radius and scrolling)
/**
* Opera Bug (SVG Data URI background, border-radius and scrolling)
*/
.icon {
display: inline-block;
width: 128px;
height: 128px;
margin: 20px 20px 20px 0;
background-color: #eee;
@codepunkt
codepunkt / bookmarklet.html
Created February 17, 2012 21:28
Toggle Style-Elements
<a href="javascript:(function(d,g,a,b,c,e,f,h,n,t,u,w,x){f=function(e,o,k){for(k in o)e.setAttribute(k,o[k])};c=function(e){return d.createElement(e)};n=function(s){return d.createTextNode(s)};a=function(e,c,k){for(k in c)e.appendChild(c[k])};w=c(g);h=c(g);t=n('Toggle Style-Elements');u=c('ul');b=d.querySelector('body');x='position:fixed;top:0;right:0;z-index:99999;margin:0;padding:0;background:#f4fff4;color:#99ad85;font:14px Helvetica,Arial,sans-serif;border:1px solid #bada55;border-top-width:0;border-right-width:0;border-bottom-left-radius:10px;';e=d.getElementById('tcss');if(b&&e)f(e,{style:x+(e.style.display=='none'?'':'display:none')});else if(b){f(w,{id:'tcss',style:x});f(h,{style:'font:20px Georgia,serif;padding:10px;margin:0;background:#dae7da;color:#693'});f(u,{style:'margin:0;padding:10px;list-style-type:disc'});f(u,{style:'margin:0;padding:10px;list-style-type:disc;'});a(b,[w]);a(w,[h,u]);a(h,[t]);[].slice.call(d.styleSheets).forEach(function(s,i,l,m,y,z){y='margin:0 0 0 20px;padding:0;cursor:point
@codepunkt
codepunkt / plus-brackets-only.js
Created June 1, 2011 20:22 — forked from cowboy/plus-brackets-only.js
What results can you get just using these characters: +[]
// What results can you get just using these characters: +[]
// I know this has been done before, but I don't have the link,
// and I don't want it (not yet, at least)
// basic numbers
0: +[]
1: ++[+[]][+[]]
2: ++[++[+[]][+[]]][+[]]
3: ++[++[++[+[]][+[]]][+[]]][+[]]
4: ++[++[++[++[+[]][+[]]][+[]]][+[]]][+[]]
@codepunkt
codepunkt / random-rotate.js
Created June 1, 2011 18:18
jQuery - Bannerrotation, zufällig
$(function() {
var images = $('#banner').children();
images.filter(':eq(' + ~~(Math.random() * images.hide().length) + ')').show();
setInterval(function() {
var current = images.filter(':visible').fadeOut(),
next = (current.next().length ? current.next() : images.eq(0)).fadeIn();
}, 2000);
});
@codepunkt
codepunkt / app.js
Created May 31, 2011 18:50
ExpressJS: set/delete cookies
// Dependencies.
var express = require('express')
app = module.exports = express.createServer(),
del = function(req, res) { res.clearCookie('login_token'); res.redirect('/'); },
set = function(req, res) { res.cookie('login_token', +new Date(), { maxAge: 3600000, path: '/' }); res.redirect('/'); };
// Config
app.configure(function() {
app.use(express.bodyParser());
app.use(express.cookieParser());