Skip to content

Instantly share code, notes, and snippets.

@minitech
minitech / dabblet.css
Created September 13, 2012 02:15
Stroked, shadowed text!
/**
* Stroked, shadowed text!
* http://stackoverflow.com/q/12398429/707111
*/
@import url("http://fonts.googleapis.com/css?family=Londrina+Solid");
body {
background-color: #d47400;
}
@minitech
minitech / dabblet.css
Created September 13, 2012 02:13
Alternating background colours
/**
* Alternating background colours
*/
.postcontainer {
background-color: lightblue;
padding: 0.2em;
}
.postcontainer:nth-of-type(2n) {
@minitech
minitech / dabblet.css
Created September 13, 2012 01:01
Alternating background colours
/**
* Alternating background colours
*/
.postcontainer {
background-color: lightblue;
padding: 0.2em;
}
.postcontainer:nth-of-type(2n) {
@minitech
minitech / dabblet.css
Created September 11, 2012 18:41
Automatically scaling a background image
/**
* Automatically scaling a background image
*/
background-image: url('http://www.gstatic.com/ui/v1/icons/mail/logo_default.png');
background-position: center;
background-repeat: no-repeat;
background-size: auto 100%;
min-height: 100%;
@minitech
minitech / dabblet.css
Created September 11, 2012 14:36
Overriding a class with tags
/**
* Overriding a class with tags
*
* IDs have a value of 100, classes have a value of 10, tags have a value of 1. In an arbitrarily large base.
* Which apparently (at least on my browser) is 256.
* (Why do I know this?)
*/
div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div div
function js_string($value) {
return '"' . str_replace(array("\r\n", "\r", "\n"), array("\n", "\n", '\n'), addslashes($value)) . '"';
}
@minitech
minitech / dabblet.css
Created August 28, 2012 22:05
Pretending that a webfont is bold.
/**
* Pretending that a webfont is bold.
* http://stackoverflow.com/a/12168041/707111 ​
*/
@font-face {
font-family: 'Headland One';
font-style: normal;
font-weight: 400;
src: local('Headland One'), local('HeadlandOne-Regular'), url(http://themes.googleusercontent.com/static/fonts/headlandone/v1/iGmBeOvQGfq9DSbjJ8jDV3hCUOGz7vYGh680lGh-uXM.woff) format('woff');
@minitech
minitech / catify.js
Created August 11, 2012 16:59
Catify
// Translates web pages to cat
!function(d,p,i,j,c,n){for(p=d.querySelectorAll('p'),i=p.length;j--&&(n=c[j])||i--&&(c=p[i].childNodes,n=c[j=c.length-1]);)if(n.nodeType==3)p[i].replaceChild(d.createTextNode(n.nodeValue.replace(/([a-z])[a-z]*/gi,function(p,i){return/[a-z]/.test(i)?'meow':'Meow'})),n);}(document);
// Some code I found from 2009 :)
function isNullOrUndefined(o) {
if(o === null) {
return true;
}
if(typeof o === "undefined") {
return true;
}
if(o === undefined) {
@minitech
minitech / ball.js
Created August 11, 2012 00:52
Ball bashing head against ceiling
// A failed attempt
function animate() {
g.clearRect(0, 0, 32, 32);
var t = (new Date().getTime() - start) / 1000;
var circlePosition = Math.min(1, Math.abs(Math.tan(t * Math.PI) / Math.PI));
g.beginPath();
g.arc(16 + Math.cos(circlePosition * Math.PI) * 8, 16 + Math.sin(circlePosition * Math.PI) * 8, 2.5, 0, Math.PI * 2);