Skip to content

Instantly share code, notes, and snippets.

View jakefentress's full-sized avatar

Jake Fentress jakefentress

View GitHub Profile

Keybase proof

I hereby claim:

  • I am jacobfentress on github.
  • I am jfentress (https://keybase.io/jfentress) on keybase.
  • I have a public key ASBxjdyR0hRHSBzx_KYGV96xf3UtJTheWxGLUuJmg1ev8Ao

To claim this, I am signing this object:

@jakefentress
jakefentress / rename-in-gruntfile.js
Created August 2, 2016 21:15
Renaming in Grunt - also works to move a file to a directory related to file name
```
files: [
{
expand: true,
cwd: 'branding/',
src: ['**/*.scss'],
dest: 'branding/',
ext: '.css',
rename: function(dest, src) { return (dest + src).replace('scss', 'css'); }
},
@jakefentress
jakefentress / argument.md
Last active August 29, 2015 14:06
Pass an argument to a WordPress nav walker function.

One other way involves adding a custom argument to the wp_nav_menu() function. This is handy if you need to pass a value from outside of the walker class altogether:

wp_nav_menu( array( 
    'theme_location' => 'secondary',
    'depth' => 1,
    'walker' => new Custom_Walker(),
    'walker_arg' => 'Custom argument value here'
) );
@jakefentress
jakefentress / layout.html
Created July 8, 2014 19:14
Getting posts based on their category from a page's url.
{% assign category = page.url | remove: '/index.html' | split: '/' | last %}
{% for post in site.categories[category] %}
<li>{{ post.title }}</li>
{% endfor %}
@jakefentress
jakefentress / form_validation.html
Created June 30, 2014 19:30
What's a nice way to tell the browser to ignore all HTML5-related validation, and take over the entire process?
<!-- Simple, just add the novalidate property to any element you don't want the browser to validate, like so: -->
<form>
<input type="email" name="email" required novalidate />
<input type="password" name="password" required />
<button type="submit">Log in</button>
</form>
<!--
Since you wish to only cancel validation when JavaScript is available, add it with JavaScript (using jQuery for simplified example)
@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 -->
@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 / 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 / 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.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);