Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Find Scrollbar width, necessary for sensible, perfect, Wide and Full Alignments.
*
* @package Some_Theme
*/
/**
* Learned from code at
* https://www.filamentgroup.com/lab/scrollbars/
* and
{
"cmd": [
"lessc",
"${file_base_name}.less",
"${file_base_name}.css",
"--no-color",
"--no-ie-compat",
"--verbose",
"--source-map=${file_base_name}.map",
],
@brysongilbert
brysongilbert / css-gradient-mixin.less
Created October 15, 2012 20:35
LESS Mixin for CSS/SVG Vertical Gradients
// Vertical gradient using CSS where possible, and base64-encoded SVG for IE9 (enables use of this in combination with border-radius)
// Based on this by Phil Brown: http://blog.philipbrown.id.au/2012/09/base64-encoded-svg-gradient-backgrounds-in-less/
// Also based on a mixin from Twitter Bootstrap: https://github.com/twitter/bootstrap
.gradient-vertical(@startColor, @endColor) {
// IE9 prep
@dataPrefix: ~"url(data:image/svg+xml;base64,";
@dataSuffix: ~")";
@dataContent: ~'<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 1 1" preserveAspectRatio="none"><linearGradient id="g743" gradientUnits="userSpaceOnUse" x1="0%" y1="0%" x2="0%" y2="100%"><stop stop-color="@{startColor}" offset="0"/><stop stop-color="@{endColor}" offset="1"/></linearGradient><rect x="0" y="0" width="1" height="1" fill="url(#g743)"/></svg>';
@nacin
nacin / some-plugin.php
Created November 5, 2011 20:54
Sample Taxonomy Column on edit.php
<?php
add_action( 'init', function() {
register_taxonomy( 'some-taxonomy', 'post', array(
'show_ui' => true,
'rewrite' => false,
'public' => true,
'labels' => array(
'name' => 'Some Taxonomy',
'singular_name' => 'Some Taxonomy',
// Original code from http://www.blog.highub.com/mobile-2/a-fix-for-iphone-viewport-scale-bug/
var metas = document.getElementsByTagName('meta');
var i;
if (navigator.userAgent.match(/iPhone/i)) {
for (i=0; i<metas.length; i++) {
if (metas[i].name == "viewport") {
metas[i].content = "width=device-width, minimum-scale=1.0, maximum-scale=1.0";
}
}
@WraithKenny
WraithKenny / quick-get-wp.php
Created March 11, 2011 23:09
Gets WordPress latest and uncompress it.
<?php
exec('wget http://wordpress.org/latest.tar.gz');
exec('tar -xzvf latest.tar.gz');
?>
@redoPop
redoPop / jquery.loadshiv.js
Created December 10, 2010 05:35
Replacement jQuery.load() for use with innerShiv
// jQuery plugin based on .load() for use with innerShiv
// http://jdbartlett.github.com/innershiv for more info
// $('selector').loadShiv('example.html selector');
jQuery.fn.loadShiv = function (url, params, callback) {
var off, selector, self, type;
if (!this.length || typeof url !== 'string') {
return this;
}
<!DOCTYPE html>
<!-- Helpful things to keep in your <head/>
// Brian Blakely, 360i
// http://twitter.com/brianblakely/
-->
<head>
<!-- Disable automatic DNS prefetching.