Skip to content

Instantly share code, notes, and snippets.

View ivanblagdan's full-sized avatar

Ivan Blagdan ivanblagdan

View GitHub Profile
@ivanblagdan
ivanblagdan / .zshrc
Created September 11, 2014 18:57
Shell aliases to aid in HTML entity encoding/decoding.
alias htmlencode="perl -MHTML::Entities -pe 'encode_entities(\$_)'"
alias htmldecode="perl -MHTML::Entities -pe 'decode_entities(\$_)'"
# Example use
# htmldecode < input.xml > output.xml
@ivanblagdan
ivanblagdan / wp_flush_rewrite.sql
Created June 24, 2014 11:34
SQL to flush WordPress rewrite rules.
DELETE FROM wp_options WHERE option_name LIKE 'rewrite_rules'
@ivanblagdan
ivanblagdan / drupal_import.sql
Created June 12, 2014 17:47
SQL to copy simple blog posts from Drupal to WordPress
INSERT INTO wordpress.wp_posts
(id, post_author, post_date, post_content, post_title, post_excerpt,
post_name, post_modified, post_type, `post_status`)
SELECT DISTINCT
n.nid `id`,
n.uid `post_author`,
FROM_UNIXTIME(n.created) `post_date`,
b.body_value `post_content`,
n.title `post_title`,
@ivanblagdan
ivanblagdan / backtrace.php
Created June 12, 2014 09:43
error backtrace without xdebug
function process_error_backtrace($errno, $errstr, $errfile, $errline, $errcontext = false) {
if(!(error_reporting() & $errno))
return;
switch($errno) {
case E_WARNING :
case E_USER_WARNING :
case E_STRICT :
case E_NOTICE :
case E_USER_NOTICE :
$type = 'warning';
@ivanblagdan
ivanblagdan / console
Created April 14, 2014 11:54
Mass-select existing authors during Wordpress wxml import.
(function($){
$('#authors > li').each(function(){
var textstring = $(this).find('strong').text().split(" (");
console.info(textstring[0]);
$(this).find('select[name^=user_map] option').filter(function() {
return $(this).text() == textstring[0];
}).prop('selected', true);
});
})(jQuery);
@ivanblagdan
ivanblagdan / relativetime.js
Created March 17, 2014 09:08
relativetime.js
relativeTime: function (timeString) {
var delta, parsedDate, r;
// Create a Date object
parsedDate = Date.parse(timeString);
// Get the number of seconds ago that the tweet was created
delta = (Date.parse(Date()) - parsedDate) / 1000;
// String to hold the relative time
diff --git a/js/background.js b/js/background.js
index f9df64a..9f1c188 100644
--- a/js/background.js
+++ b/js/background.js
@@ -6,9 +6,9 @@
last_id: 0,
change_pic_animations: 0,
bg_types: [
- {size: 'xsmall', scale: 0.35, layer_factor: 0.4, mouse_factor: -1.4},
- {size: 'small', scale: 0.5, layer_factor: 0.8, mouse_factor: -0.8},
@ivanblagdan
ivanblagdan / zoran-kac-issue1.diff
Last active December 31, 2015 22:49
zoran-kac-issue1.diff
diff --git a/content-page.php b/content-page.php
index d2f0abc..75daa60 100755
--- a/content-page.php
+++ b/content-page.php
@@ -43,7 +43,7 @@
}
// Display the content
- echo $post_content;
+ echo apply_filters( 'the_content', $post_content );
@ivanblagdan
ivanblagdan / gallery-shortcode.php
Created December 11, 2013 11:34
WP Gallery shortcode parsing example
@ivanblagdan
ivanblagdan / ext-xdebug.ini
Created October 11, 2013 16:42
ext-xdebug.ini
[xdebug]
zend_extension="/usr/local/Cellar/php53-xdebug/2.2.3/xdebug.so"
xdebug.max_nesting_level = 1000
xdebug.default_enable = On
xdebug.remote_enable = On
xdebug.remote_handler = dbgp
xdebug.remote_host = localhost
xdebug.remote_port = 9000
xdebug.remote_mode = req
xdebug.remote_connect_back = 1