Latest 100 public snipts »
d13t's
snipts
showing 1-20 of 32 snipts
-
∞ Getting rid of the 'allowed tags' in Wordpress comment forms.
<?php comment_form(array('comment_notes_after' => '')); ?>
-
∞ looping through a directory to get a linked list of files
// This: <ol> <? $dir = "files/*"; foreach(glob($dir) as $file) { ?> <li><p><a href='<?=$file?>'><?=basename($file)?></a></p></li> <? } ?> </ol> // Instead of this oldtimer: <ol> <? function getMap($dir){ if (is_dir($dir)){ $file = opendir($dir); while (true == ($map = readdir($file))){ if ($map!=".."&&$map!=".") $array[] = $map; } closedir($file); return $array; } } if (is_dir("files")){ foreach ((array) getMap("files") as $key => $value) { ?> <li><p><a href='files/<?=$value?>'><?=$value?></a></p></li> <? } } ?> </ol>
-
∞ kerning type css
/* kerning and readability improvement in Safari and Chrome */ html { text-rendering: optimizeLegibility; }
-
∞ smooth operator
/****SMOOTH OPERATOR********/ /* Make fonts appear smoother in Safari & Chrome */ html { -webkit-font-smoothing: antialiased; }
-
∞ set device width ipad/iphone
<meta name="viewport" content="width=device-width,maximum-scale=1.0" />
-
∞ display orientation
<link rel="stylesheet" media="all and (orientation:portrait)" href="portrait.css"> <link rel="stylesheet" media="all and (orientation:landscape)" href="landscape.css"> <h1 id="portrait">You're Viewing in Portrait Mode</h1> <h1 id="landscape">You're Viewing in Landscape</h1>
-
∞ css target ipad
<link rel="stylesheet" media="only screen and (max-device-width: 1024px)" href="../ipad.css" type="text/css" />
-
∞ css target iphone 4
<link rel="stylesheet" media="only screen and (-webkit-min-device-pixel-ratio: 2)" type="text/css" href="../iphone4.css" />
-
∞ MacOS X all processes
--show all processes except Dashboard ps -cm -U username | awk '/:/ && $5!~/Dashboard/' -
∞ iPhone processes
ps acmx
-
∞ css opacity for ie6-7 & 8
//for ie6-7 .see-through { filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=80); } // or .see-through { filter: alpha(opacity=80); } //for ie8 .see-through { -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=80)"; }
-
∞ open link with javascript
//open link in new window window.open('http://www.google.com/'); //open in current window window.location.href='http://www.google.com/';
-
∞ double margin bug fix
.floatbox { float: left; width: 150px; height: 150px; margin: 5px 0 5px 100px; display: inline; }
-
∞ float fixing
#wrap { margin: 0 auto; /* to align in the middle */ width: 960px; /* or whatever you like */ overflow: hidden; } #header { display: inline; float: left; position: relative; } #navigation { float: left; overflow: hidden; /* for floating lists within the nav */ display: inline; position: relative; } #content { clear: both; float: left; display: inline; } #footer { clear: both; }
-
∞ getting rid of foreach error
<?php // double any value whose key starts with 'b' $arr = array('a'=>1, 'b1'=>2, 'b2'=>3, 'c'=>4, 'd'=>5); $non_array = null; // Normal usage with an array print "Test 1:\n"; foreach ($arr as $key => $val) { print "Key $key, Value $val\n"; } // Normal usage with a non-array (undefined or otherwise empty data set) // Outputs: Warning: Invalid argument supplied for foreach() in test.php on line 16 print "Test 2:\n"; foreach ($non_array as $key => $val) { print "Key $key, Value $val\n"; } // By casting the $non_array to an (array) type, it will function without error, skipping the loop print "Test 3:\n"; foreach ((array) $non_array as $key => $val) { print "Key $key, Value $val\n"; } print "Done.\n"; ?>
-
∞ css image hover
.image { /* image properties */ } .image:hover { -o-transition-duration: .33s; -o-transition-property: border, color, opacity, -moz-opacity; -webkit-transition-duration: .33s; -webkit-transition-property: border, color, opacity, -moz-opacity; filter:alpha(opacity=50); -moz-opacity:0.5; -khtml-opacity: 0.5; opacity: 0.5; }
-
∞ css baseline grid
body { font-family: Helvetica, Arial, sans-serif; font-size: 13px; line-height: 18px; } p { margin: 0 0 18px 0; }
-
∞ get data:image
<img alt=”logo” src=”data:image/gif;base64,<?php echo base64_encode(file_get_contents("logo.gif")) ?>”>
-
∞ disable Spotlight
// disable spotlight indexing sudo mdutil -i off // enable spotlight indexing sudo mdutil -i on // delete existing spotlight indexes sudo mdutil -E // some other options: -s = display status, -v = verbose
-
∞ symbolic link
#syntax to create symbolic link ln -s /export/space/common/archive /archive #example, link would be created in directory 'placement' ln -s /path/to/original/file/or/directory /path/to/the/placement #dropbox example ln -s /Users/username/Dropbox/theFolder /path/to/symbolic/links/directory


