Skip to content

Instantly share code, notes, and snippets.

Enrique nr1q

View GitHub Profile
@nr1q
nr1q / remove-duplicates-from-history.sh
Last active Jan 25, 2019
Get history list without duplicates
View remove-duplicates-from-history.sh
cat ~/.bash_history | nl | sort -k 2 | awk '{$1=$1};1' | uniq -f1 | sort -n | cut -d ' ' -f 2- > ~/.bash_history_noduplicates
@nr1q
nr1q / functions-conditional-enqueueing.php
Last active Aug 16, 2017
Enqueueing IE conditional stylesheets in WordPress the right way
View functions-conditional-enqueueing.php
<?php
add_action( 'wp_enqueue_scripts', 'enqueue_my_styles_and_scripts' );
/**
* Enqueue styles and scripts conditionally.
*
* Load stylesheets and scripts specifically for IE. IE10 and above does
* not support conditional comments in standards mode.
*
* @link https://msdn.microsoft.com/en-us/library/ms537512(v=vs.85).aspx
@nr1q
nr1q / qtranslate_cleanup.sql
Created Aug 8, 2017 — forked from frnhr/qtranslate_cleanup.sql
clean database after qTranslate uninstall
View qtranslate_cleanup.sql
# QTRANSLATE CLEANUP QUERIES
# create temp column to separate post content on <!--more--> tag to simplify queries
ALTER TABLE `wp_posts` ADD `tmp_excerpt` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
# split content
## fill `tmp_exceprt` column
UPDATE wp_posts SET tmp_excerpt =
@nr1q
nr1q / hide-editor.php
Created Jul 11, 2017 — forked from ramseyp/hide-editor.php
Hide the content editor for certain pages in WordPress
View hide-editor.php
<?php
/**
* Hide editor on specific pages.
*
*/
add_action( 'admin_init', 'hide_editor' );
function hide_editor() {
// Get the Post ID.
@nr1q
nr1q / mail-obfuscator.php
Last active Aug 6, 2016
Mail obfuscator
View mail-obfuscator.php
<?php
/**
* Mail obfuscation
* Original function as in @see except for the $text argument
* @see http://www.maurits.vdschee.nl/php_hide_email/
*/
function hide_email($email, $text = '') {
$character_set = '+-.0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz';
$key = str_shuffle($character_set);
You can’t perform that action at this time.