Skip to content

Instantly share code, notes, and snippets.

View deadlyhifi's full-sized avatar
🥑

Tom de Bruin deadlyhifi

🥑
View GitHub Profile
@deadlyhifi
deadlyhifi / frontend
Created December 21, 2011 08:38
WordPress frontend Ajax content loader
// button to load the content
<a class="button showloadme"><span class="finger">☞</span> Who&rsquo;s this guy?</a>
// css to momentarily display loader image
.ajaxloader { width: 32px; height: 32px; background: url(ajax-loader.gif) no-repeat; margin: auto; }
@deadlyhifi
deadlyhifi / dhf_sort.css
Created December 21, 2011 17:42
WordPress - class to make custom posttypes sortable with AJAX in admin.
#sortable-list{margin-top:20px;}
#sortable-list li{padding:10px;width:50%;font-weight:bold;cursor:move;border:1px solid #ddd;background:#f5f5f5;background:-webkit-gradient(linear, left bottom, left top, color-stop(0, #eeeeee), color-stop(1, #ffffff));background:-ms-linear-gradient(bottom, #eeeeee, #ffffff);background:-moz-linear-gradient(center bottom, #eeeeee 0%, #ffffff 100%);-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;-moz-background-clip:padding;-webkit-background-clip:padding-box;background-clip:padding-box;}
#loading-animation{display:none;}
function dhf_loadme_ajax() {
if ( isset($_POST['page_id']) ) :
file_get_contents(get_permalink( $_POST['page_id'] ));
endif;
die();
}
@deadlyhifi
deadlyhifi / functions.php
Created March 1, 2012 08:02
WordPress Pagination function
/**
* A pagination function
* @param integer $range: The range of the slider, works best with even numbers
* Used WP functions:
* get_pagenum_link($i) - creates the link, e.g. http://site.com/page/4
* previous_posts_link(' ‚ '); - returns the Previous page link
* next_posts_link(' é '); - returns the Next page link
* http://robertbasic.com/blog/wordpress-paging-navigation/
* Tweaked by tdB ...
*/
@deadlyhifi
deadlyhifi / functions.php
Last active November 22, 2018 11:54
WordPress: Rename Posts in admin menu.
/**
* Rename Posts in admin menu
*
*/
new dhf_rename_posts('News');
class dhf_rename_posts
{
private $name;
@deadlyhifi
deadlyhifi / css.scss
Created April 23, 2013 10:40
Responsive iframe width and height hack using an image to maintain the aspect ratio. Thanks to http://jsfiddle.net/Masau/7WRHM/
.map {
position: relative;
min-height: 200px;
.ratio {
display: block;
width: 100%;
height: auto;
}
iframe {
.element:before {
content: "";
position: absolute;
top: -20px;
left: 50%;
margin-left: -20px;
width: 0;
height: 0;
border-style: solid;
border-width: 0 20px 20px 20px;
@deadlyhifi
deadlyhifi / functions.php
Last active December 20, 2015 10:08
WordPress - disable admin bar.
/**
* Hide admin bar for all.
*/
add_filter('show_admin_bar', '__return_false');
or
/**
* Show admin bar only to those who can edit posts.
*/
@deadlyhifi
deadlyhifi / taxonomy_menu_class.php
Created September 2, 2013 14:23
Display parent and child level taxonomy (category) dependent on what content is currently being displayed.
<?php
function pi_conditions_overview() {
$conditions = new Tax_List( 'condition' ); // put in name of taxonomy
$conditions->display_html();
}
class Tax_List {

OS X Preferences


#Disable window animations
defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool false

#Enable repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false