Skip to content

Instantly share code, notes, and snippets.

View jmslbam's full-sized avatar
💭
Available for (WordPress) work

Jaime Martínez jmslbam

💭
Available for (WordPress) work
View GitHub Profile
@ddebernardy
ddebernardy / WP-SubdirInstall-Fixes.php
Last active October 21, 2016 13:34
SubdirInstall component for WordPress
<?php
namespace Mesoconcepts\WordPress\Plugin\BugFixes\Component;
use Mesoconcepts\WordPress\Bridge\Component\WordPressInterface;
use Mesoconcepts\WordPress\Bridge\DependencyInjection\EagerLoadedInterface;
use Mesoconcepts\WordPress\Bridge\DependencyInjection\EventSubscriberInterface;
/**
* Subdir install fixes -- part of MIT-licensed `mesoconcepts/mc-bug-fixes` plugin
*
@jchristopher
jchristopher / gist:10211284
Last active August 29, 2015 13:58
Use SearchWP in conjunction with Dave's WordPress Live Search. To utilize, add the following to your theme's functions.php and save yourself the trouble of editing the plugin files.
<?php
function my_searchwp_dwls_alter_results( $search_results, $deprecated, $daves_live_search ) {
global $wp_query;
if( class_exists( 'SearchWP' ) ) {
// remove Dave's pre_get_posts
remove_action( 'pre_get_posts', array( 'DavesWordPressLiveSearchResults', 'pre_get_posts' ) );
@burnified
burnified / Enqueue Typekit via Wordpress
Created March 28, 2014 19:25
Enqueue Typekit via Wordpress
/*** TypeKit Fonts ***/
function theme_typekit() {
wp_enqueue_script( 'theme_typekit', '//use.typekit.net/hoo8stk.js');
}
add_action( 'wp_enqueue_scripts', 'theme_typekit' );
function theme_typekit_inline() {
if ( wp_script_is( 'theme_typekit', 'done' ) ) { ?>
<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
@jchristopher
jchristopher / gist:8923192
Created February 10, 2014 20:06
Force SearchWP to perform a delta update of a post after it was edited
<?php
function my_batcache_searchwp_delta_update( $post_id ) {
if ( class_exists( 'SearchWP' ) ) {
if ( $post->post_type != 'revision' && get_post_status( $post_id ) == 'publish' ) {
$searchwp = SearchWP::instance();
$searchwp->purgePost( $post_id );
$searchwp->triggerReindex();
}
}
@ejdyksen
ejdyksen / patch-edid.md
Last active April 20, 2025 08:08
A script to fix EDID problems on external monitors in macOS

patch-edid.rb

A script to fix EDID problems on external monitors in macOS.

Instructions

  1. Connect only the problem display.

  2. Create this directory structure (if it doesn't already exist):

@sgr
sgr / workaround_the_iconservices_bug_mavericks.sh
Last active July 25, 2020 11:01
When "com.apple.IconServicesAgent" exhausts CPU resources on Mac OSX mavericks (10.9), you can try following workaround.
#!/bin/sh
mkdir ${TMPDIR}/com.apple.IconServices
@mustardBees
mustardBees / functions.php
Last active October 4, 2024 13:37
Filter a few parameters into WordPress YouTube oEmbed requests. Enable modest branding which hides the YouTube logo. Remove the video title and uploader information. Prevent related videos from being shown once the video has played.
<?php
/**
* Filter a few parameters into YouTube oEmbed requests
*
* @link http://goo.gl/yl5D3
*/
function iweb_modest_youtube_player( $html, $url, $args ) {
return str_replace( '?feature=oembed', '?feature=oembed&modestbranding=1&showinfo=0&rel=0', $html );
}
add_filter( 'oembed_result', 'iweb_modest_youtube_player', 10, 3 );
#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for Display
# see http://embdev.net/topic/284710
require 'base64'
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay`
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten
@walesmd
walesmd / IconServiceAgent.md
Last active April 18, 2025 13:38
A lot of people are having issues with com.apple.IconServicesAgent. Since this is a very new issue, Google was no help and `man iconservicesd` is even more hilarious. I eventually fixed it, when I was working on a completely different issue (that is still not fixed). The instructions are below and on the Apple Support Forum, https://discussions.…

I was chasing down another issue (slow "Save As") and thought these two issues may have been related (with QuickLook being the common broken link). Unfortunately, my "Save As" dialog is still miserably slow on the initial load; but IconServicesAgent hasn't gone above 30MB and he rarely makes an appearance in the Console!

Some of these steps may not be necessary, but here are all of the steps I took that inadverdently put IconServicesAgent back in its place. Note: all commands are a single-line, if they appear to be multiple that's just the forum formatting.

  1. Check for any QuickLooks related .plist files. In a terminal: mdfind com.apple.quicklook. -name .plist

  2. I only had files at the system level (specifically within /System/Library/LaunchAgents/). If you have others, modify the directions below to take that into account (re-introducing plist files from the system level back up to the user).

  3. Make some temporary directories to store these plist files, just in case: mkdir ~/tmp-quicklook