Skip to content

Instantly share code, notes, and snippets.

View mrjasonweaver's full-sized avatar

Jason Weaver mrjasonweaver

View GitHub Profile
@mrjasonweaver
mrjasonweaver / optimize-legibility.css
Created October 23, 2011 15:57
Android webkit mobile browser optimizeLegibility bug
/* -- Android webkit mobile optimizeLegibility bug --
A noticeable rendering bug when using the
Cross-browser kerning-pairs & ligatures css
declaration (text-rendering: optimizeLegibility;)
where the anchor links are highlighted and set
just above the actual text. This makes it difficult
to touch activate the link properly.
Use Modernizr to detect for touch events &
@mrjasonweaver
mrjasonweaver / mediaboxes.html
Created December 18, 2011 01:26
Media Boxes for Mobile-First Responsive Web Design
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0;">
<title>Media Boxes</title>
<style>
/* Reset */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
@mrjasonweaver
mrjasonweaver / gist:1994246
Created March 7, 2012 16:36
Storing Page Title with data attributes in WordPress
<?php $page_title = get_the_title($post->post_parent); ?>
<footer id="footer" data-theme="<?php echo bloginfo('stylesheet_directory'); ?>" data-page="<?php echo $page_title ?>" role="contentinfo">
</footer><!-- #footer -->
@mrjasonweaver
mrjasonweaver / gist:1996428
Created March 7, 2012 21:42
Display content using variables stored in data attributes
var $footer = $('#footer'),
$themeURL = $footer.data('theme'),
$currentPage = $footer.data('page');
window.onload = function () {
var display = $('#scene').css('display');
if (display == 'block') {
displayFeatures();
}
}(this);
@mrjasonweaver
mrjasonweaver / server.js
Created October 11, 2012 15:34
Simple static file server with Connect and Node.js
var connect = require('connect');
var port = 9123;
var filepath = '/FILE_PATH'
server = connect.createServer(
connect.favicon()
, connect.logger()
, connect.static(__dirname + filepath)
)
server.listen(port);
@mrjasonweaver
mrjasonweaver / SASS Modular Type
Created October 25, 2012 21:14
Sassy typography and modular scales
/* ------ Variables */
$type-ratio: 1.25; // major third
$pwr-2: $type-ratio * $type-ratio;
$pwr-3: $type-ratio * $type-ratio * $type-ratio;
$pwr-4: $type-ratio * $type-ratio * $type-ratio * $type-ratio;
$type-base: 1rem; // 16px
$type-base-px: 16px;
$line-height-base: $type-ratio;
$type-margin-bottom: $type-base * $pwr-2;
@mrjasonweaver
mrjasonweaver / selectRevealOnChange.js
Created November 9, 2012 17:10
Reveal Extra Fields OnChange Select with jQuery
App.selectRevealChange = function(selector, val_text, reveal_container) {
// console.log(selector, val_text, reveal_container);
$(reveal_container).hide();
$(selector).change(function () {
// console.log($(selector+" option:selected").val(), '===', val_text );
if ($(selector+" option:selected").val() === val_text) {
$(reveal_container).slideDown('fast');
}
});
}
@mrjasonweaver
mrjasonweaver / viewportbodyclasses.js
Created November 12, 2012 23:02
Body classes for media queries
var Home = {};
Home.resizer = function() {
if ($(window).width() < 900 ) {
$("body").removeClass("lg-screen").addClass("sm-screen");
// Hide stuff with js so people without js can see it by default (who doesn't have js, really?)
$('.sm-screen .site-search').addClass('closed');
}
else {
$("body").removeClass("sm-screen").addClass("lg-screen");
<!DOCTYPE html>
<html>
<body>
<form>
<fieldset>
<p><label for="form-app-question">Question?</label></p>
<p><input type="radio" name="app-question" class="radio-select-reveal" id="app-question-1" value="no" /><label for="app-question-1">No</p>
<p><input type="radio" name="app-question" class="radio-select-reveal" id="app-question-2" value="yes-question" /><label for="app-question-2">Yes (with extra)</label></p>
<div id="yes-question-extra" class="extra-data">Select something<br>
<select name="choose_question">
<div id="container">
<p class="reveal-container">
<label for="form-app-school-country">Country</label>
<select name="app-country" class="progressive-reveal">
<option value="" selected="selected">Select a Country</option>
<option value="USA">United States</option>
<option value="CA">Canada</option>
<option value="Else">Everything Else</option>
</select>
</p>