/* firefox Browser*/
body { overflow-y: scroll; }
/* ie Browser*/
body { overflow:visible; }
Tag Archive for hack
WordPress – Get current category name and / or ID
<?php
//AKTUELLE Post-KATEGORIE-ID ermitteln
foreach((get_the_category()) as $category)
{
$postcat= $category->cat_ID;
$catname =$category->cat_name;
//echo $postcat;
}
?>
WordPress display content of a category on a page
<?php if (is_page('pagename')) { query_posts('cat=yx') } ?>
<!--or use query_posts like this:(full loop)-->
<?php
$displayposts = new WP_Query();
$displayposts->query('cat=5');
while ($displayposts->have_posts()) : $displayposts->the_post();
?>
<?php the_content('read more...'); ?>
<?php edit_post_link('edit', '', ''); ?>
<?php endwhile; ?>
Hacky screen clearing through printf
#include <stdio.h>
int main(){
printf(" 33[2J 33[0;0f");
printf(" 33[%d;%df", 0, 0);
return 0 ;
}
Fluid high-quality image scaling with CSS and JS
/*
<a href="http://unstoppablerobotninja.com/entry/fluid-images/" >http://unstoppablerobotninja.com/entry/fluid-images/</a>
var imgSizer = {
Config : {
imgCache : []
,spacer : "/path/to/your/spacer.gif"
}
,collate : function(aScope) {
var isOldIE = (document.all && !window.opera && !window.XDomainRequest) ? 1 : 0;
if (isOldIE && document.getElementsByTagName) {
var c = imgSizer;
var imgCache = c.Config.imgCache;
var images = (aScope && aScope.length) ? aScope : document.getElementsByTagName("img");
for (var i = 0; i < images.length; i++) {
images[i].origWidth = images[i].offsetWidth;
images[i].origHeight = images[i].offsetHeight;
imgCache.push(images[i]);
c.ieAlpha(images[i]);
images[i].style.width = "100%";
}
if (imgCache.length) {
c.resize(function() {
for (var i = 0; i < imgCache.length; i++) {
var ratio = (imgCache[i].offsetWidth / imgCache[i].origWidth);
imgCache[i].style.height = (imgCache[i].origHeight * ratio) + "px";
}
});
}
}
}
,ieAlpha : function(img) {
var c = imgSizer;
if (img.oldSrc) {
img.src = img.oldSrc;
}
var src = img.src;
img.style.width = img.offsetWidth + "px";
img.style.height = img.offsetHeight + "px";
img.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='scale')"
img.oldSrc = src;
img.src = c.Config.spacer;
}
// Ghettomodified version of Simon Willison's addLoadEvent() -- <a href="http://simonwillison.net/2004/May/26/addLoadEvent/" >http://simonwillison.net/2004/May/26/addLoadEvent/</a>
,resize : function(func) {
var oldonresize = window.onresize;
if (typeof window.onresize != 'function') {
window.onresize = func;
} else {
window.onresize = function() {
if (oldonresize) {
oldonresize();
}
func();
}
}
}
}
*/
img,
object {
max-width: 100%; /* Automatically scales height proportionally in FF, IE8, Safari >2 */
}
img { -ms-interpolation-mode: bicubic; } /* IE8 scaling of JPEG */
IE6 Only CSS. Also make IE6 use PNG backgrounds
#Logo{
Width: 100px;
Height: 100px;
Background-Image: URL("Logo.png");
Background-Repeat: No-Repeat;
/*---IE6 Only--*/
_Background-Image: URL("");
Filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='Logo.png', sizingMethod='scale');
/*-/-IE6 Only--*/
}
IE7 only star html hack
/* the following rules apply only to IE7 */ *+html .foo{ }
force word-wrap in IE
.wrapme
{
word-wrap: break-word;
}
Easiest way to make HAML use double quotes instead of single quotes
# On line 63 of haml-2.1.0/lib/haml/engine.rb, change :attr_wrapper => "'", # to :attr_wrapper => """,