Skip to content

Instantly share code, notes, and snippets.

@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);
@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');
function js_string($value) {
return '"' . str_replace(array("\r\n", "\r", "\n"), array("\n", "\n", '\n'), addslashes($value)) . '"';
}
@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
@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 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 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 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 18, 2012 02:35
Fixed elements that have a right margin relative to a content element
/**
* Fixed elements that have a right margin relative to a content element
* http://stackoverflow.com/q/12469476/707111
*/
html, body {
height: 100%;
margin: 0;
}
@minitech
minitech / file_parts.rb
Created October 4, 2012 04:23
Getting a file's name and extension*s*
# https://twitter.com/garybernhardt/status/253708758964903936
def file_parts(filename)
parts = filename.split '.'
last_spaces =
parts.rindex do |part|
part.include? ' '
end
[parts[0..last_spaces].join('.'), parts[last_spaces+1..-1]]