Skip to content

Instantly share code, notes, and snippets.

View k33n's full-sized avatar
🎯
Focusing

Michael Keene k33n

🎯
Focusing
View GitHub Profile
@redoPop
redoPop / .gitignore
Created June 18, 2010 22:08
Template .gitignore file for WordPress projects
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your
@wesbos
wesbos / is_blog.php
Created September 2, 2011 19:32
WordPress is_blog()
function is_blog () {
global $post;
$posttype = get_post_type($post );
return ( ((is_archive()) || (is_author()) || (is_category()) || (is_home()) || (is_single()) || (is_tag())) && ( $posttype == 'post') ) ? true : false ;
}
Usage:
<?php if (is_blog()) { echo 'You are on a blog page'; } ?>
@paulirish
paulirish / rAF.js
Last active March 22, 2024 00:00
requestAnimationFrame polyfill
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
@jchristopher
jchristopher / team-member-spotlight.php
Created February 27, 2012 12:06
Handlebars.js & WordPress Templates - Team Member Spotlight
<?php global $handlebars; ?>
<?php if( !$handlebars && has_post_thumbnail() ) : ?>
<?php $headshot = wp_get_attachment_image_src( get_post_thumbnail_id(), 'thumbnail' ); ?>
<img src="<?php echo $headshot[0]; ?>" alt="Headshot" class="alignleft" />
<?php elseif( $handlebars ) : ?>
{{#if headshot}}
@seamusleahy
seamusleahy / functions.php
Created September 11, 2012 17:08
Simply add AJAX callbacks to your WordPress Theme
<?php
/**
* 1. Add this to your theme's functions.php file.
* 2. Create an 'ajax' folder in your theme directory.
* 3. Create a PHP file to handle the AJAX call in the ajax folder.
* 4. From Javascript, make an AJAX call using jQuery:
* 5. $.get( window.themeSettings.ajaxUrl, {action: window.themeSettings.themeAjaxAction, template: 'YOUR TEMPLATE NAME (MINUS THE .php EXTENSION)'}, function( data ) { } );
*/
@malarkey
malarkey / Contract Killer 3.md
Last active May 24, 2024 23:38
The latest version of my ‘killer contract’ for web designers and developers

When times get tough and people get nasty, you’ll need more than a killer smile. You’ll need a killer contract.

Used by 1000s of designers and developers Clarify what’s expected on both sides Helps build great relationships between you and your clients Plain and simple, no legal jargon Customisable to suit your business Used on countless web projects since 2008

…………………………

@ronalfy
ronalfy / has_post_thumbnail_fail.php
Last active July 31, 2022 10:11
Use Auto-Generate-Thumbnail plugin to generate thumbnail images when has_post_thumbnail is erroring out. This assumes you are inside of the WordPress loop.
<?php
//Assumes within the WordPress Loop
$args = array ('title' => $post->post_title);
if ( strlen( $img = get_the_post_thumbnail( get_the_ID() ) ) ) {
/* display thumbnail */
the_post_thumbnail( 'thumbnail', $args );
} else {
delete_post_meta( $post->ID, '_thumbnail_id' );
//Requires Auto Post Thumbnails plugin - http://wordpress.org/extend/plugins/auto-post-thumbnail/
if ( function_exists( 'apt_publish_post' ) ) {
@don1138
don1138 / font-stacks.css
Last active May 14, 2024 13:16
CSS Modern Font Stacks
/* Modern Font Stacks */
/* System */
font-family: system, -apple-system, ".SFNSText-Regular", "San Francisco", "Roboto", "Segoe UI", "Helvetica Neue", "Lucida Grande", sans-serif;
/* System (Bootstrap 5.2.0) */
font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
/* Times New Roman-based serif */
font-family: Cambria, "Hoefler Text", Utopia, "Liberation Serif", "Nimbus Roman No9 L Regular", Times, "Times New Roman", serif;
@kurtmilam
kurtmilam / gravity_forms_custom_webhooks.php
Last active December 21, 2015 13:59
Create custom webhooks for Gravity Forms submissions
/* Copyright (C) 2012-2014 Kurt Milam - http://xioup.com | Source: https://gist.github.com/6316124
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TO
@cheeaun
cheeaun / image-processing-services.md
Last active April 20, 2024 22:17
3rd-party image processing/manipulation/upscaling/enlarging services