Skip to content

Instantly share code, notes, and snippets.

View nternetinspired's full-sized avatar

Seth Warburton nternetinspired

View GitHub Profile
@nternetinspired
nternetinspired / gist:7482445
Last active February 24, 2022 17:20
Load Disqus comments only on demand if you give a shit about page weight and your visitors. Even with no comments, i.e. an empty comment form, calling Disqus will load an extra 226Kb. If your page has comments this can be far higher. This Gist accompanies my blog post: http://internet-inspired.com/wrote/load-disqus-on-demand/
// Requires jQuery of course.
$(document).ready(function() {
$('.show-comments').on('click', function(){
var disqus_shortname = 'YOUR-DISQUS-USERNAME'; // Replace this value with *your* username.
// ajax request to load the disqus javascript
$.ajax({
type: "GET",
url: "http://" + disqus_shortname + ".disqus.com/embed.js",
dataType: "script",
@nternetinspired
nternetinspired / Modernizr conditional loading
Created July 16, 2012 08:34
Conditional resource loading, using Modernizr's yepnope tests, based on viewport size. Placed immediately before the closing head tag in index.php this can be used to load specific resources against reported viewport sizes
<!-- Something like this -->
<script>
Modernizr.load({
test: Modernizr.mq('(min-width:400px)'),
yep: '<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/js/not-small-screen-stuff.js">',
});
</script>
<!-- Or -->
<script>
@nternetinspired
nternetinspired / gist:2995751
Created June 26, 2012 13:20
An example os Joomla system message styles
/* system messages */
dl#system-message {
border:1px solid #e5e5e5;
border:1px solid rgba(0,0,0,.15)
}
dl#system-message dt {
border-bottom:3px double #ddd;
border-bottom:3px double rgba(0,0,0,.1);
font-weight:700;
text-align:center;
@nternetinspired
nternetinspired / css3-seperator
Created April 11, 2012 20:04
A CSS3 breadcrumb seperator
ul.breadcrumbs li :after{
content:" ";
display:block;
width:1.45em;
height:1.45em;
border-top:1px solid rgba(0, 0, 0, 0.05);
border-right:1px solid rgba(0, 0, 0, 0.25);
-webkit-transform:rotate(45deg);
-moz-transform:rotate(45deg);
transform:rotate(45deg);