Skip to content

Instantly share code, notes, and snippets.

@jeremyworboys
jeremyworboys / gist:2947799
Created June 18, 2012 10:35
jQuery: Custom styled select drop-downs
/**
* Style Drop Downs
--------------------------------------------------------------------------*/
(function() {
var $selects = $("select");
if ($selects.length > 0) {
$selects.each(function(i) {
@jeremyworboys
jeremyworboys / gist:2706955
Created May 16, 2012 02:59
SH: Create Compass project
compass create . --bare --sass-dir "assets/scss" --css-dir "assets/css" --javascripts-dir "assets/js" --images-dir "assets/img"
@jeremyworboys
jeremyworboys / media-fix.py
Created May 6, 2012 04:05
Python: Media fix is designed to re-factor media queries within the CSS outputted by SASS.
#!/usr/bin/python
"""
Media fix is designed to re-factor media queries within the CSS outputted by
SASS.
Usage: python media-fix.py style.css, ...
"""
import sys
import re
@jeremyworboys
jeremyworboys / gist:2603613
Created May 5, 2012 16:01
HTML: Meta device width
<meta name="viewport" content="width=device-width, initial-scale=1.0">
@jeremyworboys
jeremyworboys / gist:2602707
Created May 5, 2012 14:04
SCSS: Media query generator
$bp-names: "narrow", "medium", "wide";
$bp-vals: "30em", "60em", "90em";
@mixin respond-to($name) {
@media screen and (min-width: nth($bp-vals, index($bp-names, $name))) {
@content
}
}
@jeremyworboys
jeremyworboys / gist:2556435
Created April 30, 2012 08:08
Javascript: Fix iOS inappropriate zooming
/*! A fix for the iOS orientationchange zoom bug.
Script by @scottjehl, rebound by @wilto.
MIT License.
*/
(function(w){
// This fix addresses an iOS bug, so return early if the UA claims it's something else.
if( !( /iPhone|iPad|iPod/.test( navigator.platform ) && navigator.userAgent.indexOf( "AppleWebKit" ) > -1 ) ){
return;
}
@jeremyworboys
jeremyworboys / gist:2403838
Created April 17, 2012 06:11
jQuery: Responsive Nav Generator
/**
* Helper Function
--------------------------------------------------------------------------*/
String.prototype.repeat = function(count) {
if (count < 1) return '';
var result = '', pattern = this.valueOf();
while (count > 0) {
if (count & 1) result += pattern;
count >>= 1, pattern += pattern;
@jeremyworboys
jeremyworboys / gist:2395306
Created April 15, 2012 23:25
CSS: clearfix
.clearfix:before, .clearfix:after { content: ""; display: table; }
.clearfix:after { clear: both; }
.clearfix { *zoom: 1; }
@jeremyworboys
jeremyworboys / placeholder.scss
Created April 4, 2012 00:42 — forked from antsa/placeholder.scss
SCSS: Placeholder
// Placeholder @mixin for Sass
//
// A mixin to style placeholders in HTML5 form elements.
// Includes also a .placeholder class to be used with a polyfill e.g.
// https://github.com/mathiasbynens/jquery-placeholder
// Requires Sass 3.2.
//
// Example usage (.scss):
//
// input {
@jeremyworboys
jeremyworboys / gist:2049932
Created March 16, 2012 12:45
Wordpress: Start Widget
<?php
error_reporting(E_ALL);
/*
Plugin Name: PLUGIN_NAME
Plugin URI: PLUGIN_URI
Description: PLUGIN_DESCRIPTION
Version: 1.0
Author: Jeremy Worboys