Skip to content

Instantly share code, notes, and snippets.

@cesarkohl
cesarkohl / gist:172905d0692ad502ccc2
Created June 21, 2015 10:24
add wordpress [] tag in PHP
<?php echo do_shortcode('[contact-form 1 "Form"]'); ?>
@cesarkohl
cesarkohl / jquery-get-all-html-including-tag
Created July 1, 2015 18:59
jQuery) Get all html including tag
<div>
<span>Hello</span>
</div>
$('div').wrap().parent().html();
@cesarkohl
cesarkohl / css-media-bootstrap
Last active September 11, 2015 17:15
css @media bootstrap
/**
* Media: Larger than
*/
@media (min-width: 1200px){
}
@media (min-width: 992px){
}
@media (min-width: 768px){
@cesarkohl
cesarkohl / wordpress-update-urls
Created July 7, 2015 20:56
wordpress update URLs
UPDATE wp_posts SET post_content = replace(post_content, 'http://old/', 'http://new/');
UPDATE wp_posts SET guid = replace(guid, 'http://old/', 'http://new/');
@cesarkohl
cesarkohl / bootstrap-centered-site
Created September 10, 2015 18:02
Bootstrap centered site
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
<div class="container">
<div class="row">
<!-- Content columns -->
<div class="col-lg-12">
<!-- Content -->
</div>
</div>
@cesarkohl
cesarkohl / css-fullscreen-section
Created September 11, 2015 17:17
CSS fullscreen section
.full-height { height: 100vh; }
@cesarkohl
cesarkohl / bootstrap-dropdown-hover
Created October 3, 2015 21:52
Bootstrap dropdown hover
@media screen and (min-width: 780px) {
.dropdown:hover .dropdown-menu { display: block; } /* enable hover dropdown */
}
@cesarkohl
cesarkohl / jquery-anchor-fade
Created October 3, 2015 21:54
jQuery - Anchor section with fade
/**
* Anchor with fade
* Example: <a href="#example-1"/> <div id="example-2"/>
*/
$('a.scroll-smooth').on('click',function (e) {
e.preventDefault();
var target = this.hash;
var $target = $(target);
@cesarkohl
cesarkohl / fixed-menu
Created October 4, 2015 01:38
jQuery fixed menu
// Fixed Menu
slider($(window).height());
$(window).scroll(function () {
slider($(window).height());
});
function slider(vh_height) {
console.log('scrollTop: '+ document.body.scrollTop +' | vh_height: '+vh_height);
if (document.body.scrollTop > vh_height)
$('nav.navbar').stop().animate({ top: 0 }, 200);
function number_format(number, decimals, dec_point, thousands_sep) {
var number = (number + '').replace(/[^0-9+\-Ee.]/g, '');
var n = !isFinite(+number) ? 0 : +number,
prec = !isFinite(+decimals) ? 0 : Math.abs(decimals),
sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep,
dec = (typeof dec_point === 'undefined') ? '.' : dec_point,
s = '',
toFixedFix = function (n, prec) {
var k = Math.pow(10, prec);
return '' + (Math.round(n * k) / k).toFixed(prec);