Skip to content

Instantly share code, notes, and snippets.

View pfulton's full-sized avatar

Patrick Fulton pfulton

View GitHub Profile
@pfulton
pfulton / SassMeister-input-HTML.haml
Created October 24, 2013 14:12
An example of using the Breakpoint extension for Sass & Compass
%section.main
%section.primary-content
%h1 About Us
%p.intro Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris orci mi, molestie quis congue ac, condimentum sit amet mauris. Curabitur a nisi nec arcu facilisis iaculis sit amet ultricies ligula.
%aside.secondary-content
%nav.secondary-navigation
%ul
%li
%a{:href => "#"} Staff
%li
@pfulton
pfulton / compass-selector-nest.css
Created July 19, 2013 21:17
Compass Selector Helpers: Nest
ul li ul li.parent ul {
display: none;
}
ul li ul li.parent.active ul {
display: block;
}
@pfulton
pfulton / pjax-picturefill.js
Created July 16, 2013 14:21
pjax + picturefill
(function($){
$(document).on('pjax:complete', function(){
if (typeof window.picturefill != 'undefined'){
window.picturefill();
}
});
}(jQuery))
@pfulton
pfulton / headings-helpers.css
Created February 13, 2013 21:40
Compass has a "headings" helper, but based on the docs, figuring out the syntax for it is a little difficult. Here's a quick example of the SCSS and its compiled result. This comes in handy more often than you'd think ;-)
h1, h2, h3, h4, h5, h6 {
text-transform: uppercase;
}
h1, h2, h3 {
font-family: Arial;
font-weight: bold;
margin-bottom: 0.35em;
color: #474747;
}
@pfulton
pfulton / home.css
Created December 14, 2012 19:04
Using Compass Placeholder Selectors in Media Queries
.press-release, .newsletter-signup {
/* business in the front */
position: absolute;
z-index: 1000;
}
.event, .yet-another-pr-thang {
/* party in the back */
position: absolute;
z-index: -1000;
@pfulton
pfulton / webkit-svg-heightfix.js
Created December 11, 2012 15:31
Webkit SVG height bugfix
// jQuery fix for Webkit SVG height bug.
// Documented here: https://bugs.webkit.org/show_bug.cgi?id=82489 & http://www.brichards.co.uk/blog/webkit-svg-height-bug-workaround
// Found via: http://stackoverflow.com/questions/7570917/svg-height-incorrectly-calculated-in-webkit-browsers
function fixWebkitHeightBug(){
var svgW = 658;
var svgH = 500;
var curSVGW = $('#svg-container').width();
var newSVGH = heightInRatio(svgH,svgW,curSVGW);
@pfulton
pfulton / box-sizing.js
Created December 10, 2012 21:17
CSS box-sizing detection with Modernizr
// test whether or not CSS box-sizing is supported. Append the relevant classes to the html element.
// for reference: http://www.snackoclock.net/2012/08/simple-box-sizing-border-box-fallback-for-ie/
Modernizr.addTest("boxsizing", function() {
return Modernizr.testAllProps("boxSizing") && (document.documentMode === undefined || document.documentMode > 7);
});
if(!Modernizr.boxsizing){
alert("No box-sizing, but we added a class for you!");
}
@pfulton
pfulton / ebook-resources.txt
Created November 6, 2012 16:10
eBook resources
*** HELPFUL LINKS ***
* Build a digital book with EPUB: http://www.ibm.com/developerworks/xml/tutorials/x-epubtut/index.html
* EPUB Validator (hosted version - file must be less than 10mb): http://validator.idpf.org/
* EpubCheck (EPUB validator - use for files larger than 10mb - command-line): http://code.google.com/p/epubcheck/
* MobileRead CSS "starter" template: http://wiki.mobileread.com/wiki/CSS_template
* EPUB Starter Kit (has some helpful links in the README): https://github.com/mattharrison/epub-css-starter-kit
* How to use Automator to batch rename files: http://www.makeuseof.com/tag/using-automator-to-batch-rename-images-mac/
* For iBooks - Understanding Apple's "Fixed Layout" EPUBS: http://blog.threepress.org/2011/01/17/understanding-apples-fixed-layout-epubs/
-- There's an extra XML file that you can add to the META-INF directory. Check the link above for details.
@pfulton
pfulton / block.html
Created October 30, 2012 18:48
Make entire "block" clickable
<article class="my-element">
<h1>Article Title</h1>
<p>Teaser text lorem ipsum.</p>
<a href="full-article.html">Read More</a>
</article>
@pfulton
pfulton / micro-address.html.haml
Created October 3, 2012 15:58
Microformat & Microdata Markup for Address in Haml
-# Because I always forget...
-# Example markup for contact info (client's address) in Haml with both Microformats & Microdata
%article.vcard{:itemscope => true, :itemtype => 'http://schema.org/Organization'}
%h1.fn.org{:itemprop => 'name'} Company Name
%div.adr{:itemprop => 'address', :itemscope => true, :itemtype => 'http://schema.org/PostalAddress'}
%span.street-address{:itemprop => 'streetAddress'}
%span.locality{:itemprop => 'addressLocality'}
%span.region{:itemprop => 'addressRegion'}
%span.postal-code{:itemprop => 'postalCode'}