This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
Copied from http://fatlabmusic.com/blog/2009/08/12/how-to-fix-wp-http-error-name-lookup-timed-out/ | |
//adjustments to wp-includes/http.php timeout values to workaround slow server responses | |
add_filter('http_request_args', 'bal_http_request_args', 100, 1); | |
function bal_http_request_args($r) //called on line 237 | |
{ | |
$r['timeout'] = 15; | |
return $r; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Display an error message at the top of the post edit screen explaining that ratings is required. | |
* | |
* Doing this prevents users from getting confused when their new posts aren't published, as we | |
* require a valid rating custom taxonomy. | |
* | |
* @param WP_Post The current post object. | |
*/ | |
function show_required_field_error_msg( $post ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
NOW=$(date +%Y-%m-%d-%H-%M-%S) | |
SQL_FILE=${NOW}_db.sql | |
# Backup database | |
/usr/local/bin/wp db export ../backups/$SQL_FILE --add-drop-table | |
# Compress the database file | |
gzip ../backups/$SQL_FILE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Creating tables in Single site installations | |
function on_activate() { | |
create_table(); | |
} | |
function create_table() { | |
global $wpdb; | |
$table_name = $wpdb->prefix . 'table_name'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { domReady } = wp; | |
const { useMemo } = wp.element; | |
const { TextControl } = wp.components; | |
const { select, useSelect, useDispatch } = wp.data; | |
const { PluginDocumentSettingPanel } = wp.editPost; | |
const { registerPlugin } = wp.plugins; | |
const { __ } = wp.i18n; | |
/** | |
* Output the Meta panel for Report pages. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Sample code to demonstrate the issue with wp_kses and allowed_html for sanitizing svg's that contain attributes with numbers at the end. | |
*/ | |
$svg = <<<SVG | |
<svg> | |
<path x1="10" y1="10"/> | |
</svg> | |
SVG; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import mandrill | |
MANDRILL_API_KEY = "api-key" | |
EMAIL_FROM = "your@email.com" | |
EMAIL_TO = "your@email.com" | |
EMAIL_SUBJECT = "Error Log" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudar@sudar-desktop:~/code/watch/openchronos-ng-modular$ mspdebug rf2500 | |
MSPDebug version 0.18 - debugging tool for MSP430 MCUs | |
Copyright (C) 2009-2011 Daniel Beer <dlbeer@gmail.com> | |
This is free software; see the source for copying conditions. There is NO | |
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
Trying to open interface 1 on 002 | |
rf2500: warning: can't detach kernel driver: No data available | |
Initializing FET... | |
FET protocol version is 30001000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int c; | |
char *hex = "0123456789abcdef"; | |
while( (c = getchar()) != EOF ){ | |
if( ('a' <= c && c <= 'z') | |
|| ('A' <= c && c <= 'Z') | |
|| ('0' <= c && c <= '9') ){ | |
putchar(c); | |
} else { | |
putchar('%'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Retrieve posts ids given their title. | |
* Use this function if there are more than one post with the same title. | |
*/ | |
function get_multiple_posts_by_title($title) { | |
global $wpdb; | |
$posts_ids = array(); | |
$posts = $wpdb->get_results( $wpdb->prepare( “SELECT ID FROM $wpdb->posts WHERE post_title = %s AND post_type=’post_type’”, $title), OBJECT ); | |
foreach ($posts as $post) { |
NewerOlder