Skip to content

Instantly share code, notes, and snippets.

View rezen's full-sized avatar

Andres Hermosilla rezen

View GitHub Profile
@rezen
rezen / input-mask.js
Created February 28, 2012 17:54
JS: input[type=File upload mask input[type="file"]!
// File upload mask
$('.upload-masked').each(function(){
var $this = $(this)
, $mask = $('<input type="text" class="upload-mask" value="" />');
$this.wrap('<div class="input-wrap" style="position:relative;"></div>');
$this.css({opacity:0,position:'absolute'});
$this.after('<span class="upload-mask-button">BROWSE</span>');
$this.after($mask);
@rezen
rezen / wp_attachfix.sql
Created March 21, 2012 22:08
Migrating WordPress attachments on new domain with WP in a sub folder
UPDATE `wp_posts` SET guid = REPLACE(guid,'*old_domain*','*new_domain*') WHERE `post_type` = 'attachment'
@rezen
rezen / gist:2654207
Created May 10, 2012 16:15
Email Address regex
^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*(\.[a-z]{2,3})$
@rezen
rezen / gist:3161175
Created July 22, 2012 22:11 — forked from luetkemj/wp-query-ref.php
WP: Query $args
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query
* Source: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/query.php
*/
$args = array(
@rezen
rezen / wp.filter.php
Created August 18, 2012 17:05
Filter Image insert for WordPress
function xf_insert_image( $html, $id, $caption, $title, $align, $url )
{
$html5 = "<figure id='post-$id media-$id' class='align-$align'>";
$html5 .= "<img src='$url' alt='$title' />";
$html5 .= "<figcaption>$caption</figcaption>";
$html5 .= "</figure>";
return $html5;
}
@rezen
rezen / scanner.php
Created January 25, 2013 00:54
Scan files (php) for questionable items ... looking for those exploits!
<?php
// Let's see those errors!
error_reporting(1);
// Give it some time!
set_time_limit(80);
// File ext(types) to check!
$check_files = array(
@rezen
rezen / rm.sql
Created June 19, 2013 06:11
Remove old WordPress post_meta
DELETE pm
FROM wp_postmeta pm
LEFT JOIN wp_posts wp ON wp.ID = pm.post_id
WHERE wp.ID IS NULL
@rezen
rezen / template.conf
Last active May 11, 2018 18:17
Example upstart for centos /etc/init/template.conf
# Below are some good links for reference
# https://gist.github.com/c4milo/940909
# https://www.exratione.com/2013/02/nodejs-and-forever-as-a-service-simple-upstart-and-init-scripts-for-ubuntu/
# http://upstart.ubuntu.com/cookbook/
# http://serverfault.com/questions/321375/passing-arguments-to-upstart-job
author "Andres Hermosilla <an2dres5m@gmail.com>"
description "Update Example Config"
# Set variables
env upstart_name=template
@rezen
rezen / cf7.html
Created April 4, 2014 16:20
Contact form 7 text
<div class="col-half">
<div class="input-block">
<label>Subject*</label>
[text* c_subject]
</div>
<div class="input-block">
<label>Company</label>
[text c_company]
</div>
<div class="input-block">
@rezen
rezen / find-dups.sql
Created May 1, 2014 18:59
mysql find duplicates of column value
SELECT email,
COUNT(email) AS NumOccurrences
FROM users
GROUP BY email
HAVING ( COUNT(email) > 1 )