Skip to content

Instantly share code, notes, and snippets.

View reactormade's full-sized avatar

Reactormade reactormade

View GitHub Profile
/**
* RETORNA URL DO POST_THUMBNAIL PARA BACKGROUND-IMAGE
* @param int: get_the_ID()
* @param string: thumbnail, medium, large, full
**/
function post_thumbnail_url($post_id, $size = 'thumbnail'){
$thumb = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), $size );
$url = $thumb[0];
return $url;
}
@reactormade
reactormade / box-sizing.css
Created December 29, 2013 20:18
Apply a natural box layout model to all elements
/*
* apply a natural box layout model to all elements
* http://www.paulirish.com/2012/box-sizing-border-box-ftw/
*/
*, *:before, *:after {
-moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box;
}
@reactormade
reactormade / error_reporting.php
Last active December 15, 2015 02:19
Do not report E_ALL errors since 5.4.0 E_STRICT became part of E_ALL. http://php.net/manual/en/function.error-reporting.php
<?php
error_reporting(E_ERROR | E_PARSE | E_NOTICE);
?>
<?php
//If you just see a blank page instead of an error reporting and you have no server access so you can't edit php configuration files like php.ini try this:
// create a new file in which you include the faulty script:
error_reporting(E_ALL);
ini_set("display_errors", 1);
include("file_with_errors.php");
// execute this file instead of the faulty script file
@reactormade
reactormade / gist:5052806
Last active December 14, 2015 07:48
Extract a string from an array of string if it matches to a another string (comparison)
function extract_matching_string_from_array($array_of_strings, $comparison){
$array = array();
foreach ($array_of_strings as $string):
if (strstr($string, $comparison)):
array_push($array, $string);
endif;
endforeach;
return $array;
}
/* apply a natural box layout model to all elements */
* { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; }
@reactormade
reactormade / get_url_parameter.js
Created December 10, 2012 19:00
Get URL parameter with JavaScript
function get_url_parameter(name) {
return decodeURI(
(new RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[null])[1]
);
}
@reactormade
reactormade / gist:4101300
Created November 17, 2012 23:18
Fix postfix on Mountain Lion
sudo mkdir -p /Library/Server/Mail/Data/spool
sudo /usr/sbin/postfix set-permissions
sudo /usr/sbin/postfix start
@reactormade
reactormade / gist:4038377
Last active October 12, 2015 14:08
Twitter Bootstrap multiple remote modals on same page
anchor(base_url().'sample/'.$object->hash,'<span class="btn btn-mini btn-info"><i class="icon-search icon-white"></i> View</span>',array('data-remote'=>base_url().'sample/'.$object->hash,'data-toggle'=>'modal','data-target'=>'#modal-sample'));
$('#modal-sample').on('hidden', function() {
$(this).removeData('modal');
});