Skip to content

Instantly share code, notes, and snippets.

View Japh's full-sized avatar

Japh Japh

View GitHub Profile
@qrush
qrush / Inconsolata-dz-Powerline.otf
Created January 11, 2012 16:50
vim-powerline patched fonts
@troy
troy / send_remote_syslog.php
Last active March 30, 2025 16:15
Send UDP remote syslog message from PHP (RFC 3164)
# replace PAPERTRAIL_HOSTNAME and PAPERTRAIL_PORT
# see http://help.papertrailapp.com/ for additional PHP syslog options
function send_remote_syslog($message, $component = "web", $program = "next_big_thing") {
$sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
foreach(explode("\n", $message) as $line) {
$syslog_message = "<22>" . date('M d H:i:s ') . $program . ' ' . $component . ': ' . $line;
socket_sendto($sock, $syslog_message, strlen($syslog_message), 0, PAPERTRAIL_HOSTNAME, PAPERTRAIL_PORT);
}
socket_close($sock);
<?php
#
# rt-theme loop
#
global $args,$content_width,$paged;
add_filter('excerpt_more', 'no_excerpt_more');
//varialbles
$video_width = ($content_width =="960") ? 940 : 606;
@agnoster
agnoster / README.md
Last active May 10, 2025 17:44
My ZSH Theme

agnoster.zsh-theme

A ZSH theme optimized for people who use:

  • Solarized
  • Git
  • Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)

For Mac users, I highly recommend iTerm 2 + Solarized Dark

@franz-josef-kaiser
franz-josef-kaiser / paranoia-config.php
Last active July 29, 2022 10:01
WordPress debug - Error Reporting Level: Paranoia
<?php
define( 'DS', DIRECTORY_SEPARATOR );
# ==================================
# PHP errors & log
error_reporting(
E_ALL | E_STRICT | E_CORE_ERROR | E_CORE_WARNING
| E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE
| E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR
);
# OR: shorter and all together
@markjaquith
markjaquith / gist:4219135
Last active September 5, 2024 01:34
Script for applying WordPress patches. Provide an ID (prompts you to select patch), a Trac patch URL, or a raw Trac patch URL
#!/usr/bin/ruby
#
# The MIT License (MIT)
# Copyright (c) 2013 Mark Jaquith
# 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
@bitfade
bitfade / gist:4555047
Last active April 3, 2025 18:18
WordPress - Remove empty p tags for custom shortcodes
<?php
add_filter("the_content", "the_content_filter");
function the_content_filter($content) {
// array of custom shortcodes requiring the fix
$block = join("|",array("col","shortcode2","shortcode3"));
// opening tag
<?php
/**
* Allows activation of plugins via WP Bulter using the "activate" keyword (ie "activate Gravity Forms")
*
*/
add_filter('wp_butler_ajax_keyword_actions', 'wp_butler_switch_plugins_action');
function wp_butler_switch_plugins_action($term_and_actions) {
list($term, $actions) = $term_and_actions;
@Japh
Japh / gist:4564616
Created January 18, 2013 13:45 — forked from spivurno/gist:4560722
<?php
add_filter('wp_butler_ajax_keyword_actions', 'wp_butler_switch_plugins_action', 10, 2);
function wp_butler_switch_plugins_action($term_and_actions) {
list($term, $actions) = $term_and_actions;
$term_words = explode( ' ', $_REQUEST['term'] );
$keyword = $term_words[0];
<?php
class GP_WPorg_Rosetta_Roles extends GP_Plugin {
var $id = 'wporg-rosetta-roles';
function __construct() {
parent::__construct();
$this->add_filter( 'pre_can_user', array( 'args' => 2, 'priority' => 9 ) );
}