Skip to content

Instantly share code, notes, and snippets.

View jakefentress's full-sized avatar

Jake Fentress jakefentress

View GitHub Profile
@jakefentress
jakefentress / relative.liquid
Created February 19, 2014 19:39
Relative links in Jekyll
{% capture lvl %}{{ page.url | append:'index.html' | split:'/' | size }}{% endcapture %}
{% capture relative %}{% for i in (3..lvl) %}../{% endfor %}{% endcapture %}
{% comment %} note the {{ relative }} tag in the URL below {% endcomment %}
<link rel='stylesheet' href='{{ relative }}css/screen.css'>
@jakefentress
jakefentress / typekit.html
Created February 19, 2014 19:42
Loading TypeKit with YepNope
<script>
yepnope.injectJs('//use.typekit.net/yiy1stl.js', function() { try{Typekit.load();}catch(e){} });
</script>
@jakefentress
jakefentress / yepnope.html
Created February 19, 2014 19:47
Loading jQuery and main JavaScript files with YepNope
<!-- jQuery and Global Functionality -->
<script>
yepnope([{
load: '//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js',
complete: function () {
if (!window.jQuery) {
yepnope('/vendor/jquery/dist/jquery.min.js');
}
}
}, {
@jakefentress
jakefentress / svg-fallback.html
Created February 20, 2014 17:04
Inline SVG Fallbacks - especially for problems with IE9
<!--[if gt IE 9]><!-->
<img src="img/wordmark.svg" onerror="this.src=img/wordmark.png;this.onerror=null;">
<!--<![endif]--><!--[if lte IE 9]>
<img src="img/wordmark.png">
<![endif]-->
@jakefentress
jakefentress / network.php
Created May 14, 2014 18:44
WordPress Multisite Network Info
<?php if( is_multisite() ): ?>
The <a href="<?php echo esc_url( get_site_option( 'siteurl' ) ); ?>"><?php echo esc_html( get_site_option( 'site_name' ) ); ?> network</a> currently powers <strong><?php echo get_blog_count(); ?></strong> websites and <strong><?php echo get_user_count(); ?></strong> users.
<?php endif; ?>
@jakefentress
jakefentress / functions.js
Created May 19, 2014 18:59
Excerpt Options for WordPress
// replace some text in the returned excerpt
function excerpt_no_podcast($output) {
global $post;
return str_replace('Podcast: Play in new window | Download ', '', $output);
}
add_filter('the_excerpt', 'excerpt_no_podcast');
// it can also be used to add a "read more" link for the manually created excerpt
function excerpt_read_more_link($output) {
global $post;
return str_replace('</p>', ' <a href="'. get_permalink( get_the_ID() ) . '">Read More&nbsp;&raquo;</a></p>', $output);
@jakefentress
jakefentress / Sublime Text Setup.md
Last active September 9, 2016 14:24 — forked from davatron5000/Sublime Text Setup.md
Preferences, color schemes, and packages for Sublime Text.

Make it useful

Install Package Control. For Sublime Text 3, paste the following in the Sublime Text console (get there via ctrl+ `):

import urllib.request,os,hashlib; h = '7183a2d3e96f11eeadd761d777e62404' + 'e330c659d4bb41d3bdf022e94cab3cd0'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://sublime.wbond.net/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)

From here on out, use Package Control to install everything. +Shift+P, then type Install to get a list of installable packages you can search through. After installing plugins, they should be running.

@jakefentress
jakefentress / functions.php
Created June 4, 2014 08:12
Remove auto paragraphs in shortcodes in WordPress
// move wpautop filter to AFTER shortcode is processed - this is so shortcodes do not get processed
remove_filter( 'the_content', 'wpautop' );
add_filter( 'the_content', 'wpautop' , 99);
add_filter( 'the_content', 'shortcode_unautop',100 );
@jakefentress
jakefentress / animation.css
Created June 6, 2014 15:48
You can 'pause' and 'play' CSS animation by changing its animation-play-state property. Setting it to 'paused' stops your animation in place, until you change animation-play-state to running, for example on hover.
.animating_thing {
animation: spin 10s linear infinite;
animation-play-state: paused;
}
. animating_thing:hover {
animation-play-state: running;
}
@jakefentress
jakefentress / favicon.html
Created June 9, 2014 21:08
Favicon and Touch Icons
<!-- FAVICON -->
<link rel="shortcut icon" href="/favicon.ico">
<!-- For third-generation iPad with high-resolution Retina display: -->
<link rel="apple-touch-icon" sizes="152x152" href="/apple-touch-icon-152x152-precomposed.png">
<!-- For iPhone with high-resolution Retina display: -->
<link rel="apple-touch-icon" sizes="120x120" href="/apple-touch-icon-120x120-precomposed.png">
<!-- For first- and second-generation iPad: -->
<link rel="apple-touch-icon" sizes="76x76" href="/apple-touch-icon-76x76-precomposed.png">
<!-- For non-Retina iPhone, iPod Touch, and Android 2.1+ devices: -->
<link rel="apple-touch-icon" href="/apple-touch-icon-precomposed.png"> <!-- 60x60 -->