Skip to content

Instantly share code, notes, and snippets.

View jaredkc's full-sized avatar

Jared Cornwall jaredkc

View GitHub Profile
@jaredkc
jaredkc / gitconfig-alias.sh
Last active August 29, 2015 14:01
A list of my Git aliases
[alias]
st = status
co = checkout
cm = commit
pr = pull --rebase
# Start over
fuckit = reset --hard
# Submodules
subup = submodule update --init --recursive
# Show verbose output about tags, branches or remotes
@jaredkc
jaredkc / group-posts-by-terms.php
Last active February 19, 2025 22:44
Wordpress: get posts and group by taxonomy terms.
/**
* Get posts and group by taxonomy terms.
* @param string $posts Post type to get.
* @param string $terms Taxonomy to group by.
* @param integer $count How many post to show per taxonomy term.
*/
function list_posts_by_term( $posts, $terms, $count = -1 ) {
$tax_terms = get_terms( $terms, 'orderby=name');
$args = array(
@jaredkc
jaredkc / git-cheat-sheet.md
Last active September 25, 2017 17:03
GIT Cheat Sheet

Git Cheat Sheet

Branches

Delete remote branch: git push origin :<branchName>

Add a remote branch: git remote add <remoteName> <gitAddress>

@jaredkc
jaredkc / sublime-packages.md
Last active December 17, 2015 07:09
Sublime Text Packages I Use
  • Alignment provides easy alignment of multiple selections and multi-line selections.
  • Autoprefixer adds the vendor prefixes to your CSS.
  • AutoFileName for autocomplete filenames.
  • BracketHighlighter marks the opening and the closing bracket of the current line of code.
  • Can I Use quickly check how well is a CSS property supported by browsers.
  • CSScomb is a coding style formatter for CSS. You can easily write your own configuration to make your stylesheets beautiful and consistent.
  • Color Highlighter
  • DocBlockr
  • Emmetgreatly improves HTML & CSS workflow.
  • [Emmet Css Snippets](http://peters-playgro
@jaredkc
jaredkc / sample.html
Created May 10, 2013 17:29
Responsive iframe (for Google Maps and such). Thanks to Niklaus Gerber: http://niklausgerber.com/blog/responsive-google-or-bing-maps/
<!-- Responsive iFrame -->
<div class="flexible-container">
<iframe>i</iframe>
</div
@jaredkc
jaredkc / script.js
Created February 28, 2013 20:16
Scroll to jQuery
/**
* Smooth Scrolling Anchor Links
* http://www.sycha.com/jquery-smooth-scrolling-internal-anchor-links
*/
$(".scroll").click(function(event){
event.preventDefault();
$('html,body').animate({scrollTop:$(this.hash).offset().top}, 500);
});
@jaredkc
jaredkc / middle.css
Last active December 14, 2015 01:29
CSS to center vertical and horizontal
.middle {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
margin: auto;
}
@jaredkc
jaredkc / wp-recent-posts.php
Last active December 9, 2015 21:38
WordPress Recent Posts
/**
* Outputs recent posts with the desired markup and data.
* Used in place of a widget to meet design requirements.
*
* Load in your theme template files with this <?php _my_recent_posts(); ?>
*/
function _my_recent_posts($recent_number = '8') {
$args = array( 'numberposts' => $recent_number );
$recent_posts = wp_get_recent_posts( $args );
echo '<ul class="recent-entries">';
@jaredkc
jaredkc / wp-build_deregister_modules.php
Last active October 10, 2015 09:37
Carrington Build : remove modules
/**
* Remove modules that are not wanted/needed.
* This example removes the carousel and hero modules.
* You just need to pass the ID of desired module(s) to remove.
*/
function build_deregister_modules() {
cfct_build_deregister_module('cfct_module_carousel');
cfct_build_deregister_module('cfct_module_hero');
}
add_action('cfct-modules-included', 'build_deregister_modules');
@jaredkc
jaredkc / Preferences.sublime-settings
Last active October 9, 2015 06:38
My User Settings for Sublime Text 2
{
"create_window_at_startup": false,
"detect_indentation": false,
"draw_white_space": "all",
"font_size": 14.0,
"font_options":
[
"gray_antialias"
],
"highlight_line": true,