I hereby claim:
- I am yrosen on github.
- I am yrosen (https://keybase.io/yrosen) on keybase.
- I have a public key ASAlm2NJYbYOqK-kMuJ9BHUFhuk6eW8fQVQQVjHu0uz5AAo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
<?php | |
// post meta for previews | |
class wp_preview_meta { | |
private $doing_preview = false; | |
public function __construct() { | |
add_filter( 'add_post_metadata', array( $this, 'add' ), 10, 5 ); | |
add_filter( 'update_post_metadata', array( $this, 'update' ), 10, 5 ); |
<?php | |
add_action('posts_where_request', function($where) use($wpdb, $wp) { | |
if(is_search()) { | |
// Change this as needed | |
$keys = implode("','", array('url', 'author', 'source', 'subtitle')); | |
// Search in meta fields as well: | |
$where .= " OR ({$wpdb->postmeta}.meta_key IN('{$keys}') AND {$wpdb->postmeta}.meta_value LIKE '%{$wp->query_vars['s']}%')"; | |
// Add in the postmeta table: |
<?php | |
/** | |
* Replaces PHP's default error handler with one that | |
* sends everything to a GELF server (tested with Graylog2) | |
* | |
* From the PHP docs: The following error types cannot be handled with | |
* a user defined function: E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, | |
* E_COMPILE_ERROR, E_COMPILE_WARNING, and most of E_STRICT raised in the | |
* file where set_error_handler() is called. | |
* |
#!/bin/sh | |
# Drop ICMP echo-request messages sent to broadcast or multicast addresses | |
echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts | |
# Drop source routed packets | |
echo 0 > /proc/sys/net/ipv4/conf/all/accept_source_route | |
# Enable TCP SYN cookie protection from SYN floods | |
echo 1 > /proc/sys/net/ipv4/tcp_syncookies |
#!/bin/sh | |
# I'm not really sure where this is originally from... | |
# It prints out a (colored!) list of background & foreground colors | |
for attr in 0 1 4 5 7 ; do | |
printf "ESC[%s;Foreground;Background - \n" $attr | |
for fore in 30 31 32 33 34 35 36 37; do | |
for back in 40 41 42 43 44 45 46 47; do | |
printf '\033[%s;%s;%sm %02s;%02s ' $attr $fore $back $fore $back |