Skip to content

Instantly share code, notes, and snippets.

View icetee's full-sized avatar
:atom:
Development

Tamás András Horváth icetee

:atom:
Development
View GitHub Profile
@icetee
icetee / placeholder-fix.js
Last active August 29, 2015 14:12
HTML5 Placeholder disappear fix on focus
$('input:text, textarea').each(function(){
var $this = $(this);
$this.data('placeholder', $this.attr('placeholder'))
.focus(function(){$this.removeAttr('placeholder');})
.blur(function(){$this.attr('placeholder', $this.data('placeholder'));});
});
@icetee
icetee / helyiertek.php
Created January 1, 2015 19:39
Helyiérték
function addPlaceValue(nStr)
{
nStr += '';
x = nStr.split('.');
x1 = x[0];
x2 = x.length > 1 ? '.' + x[1] : '';
var rgx = /(\d+)(\d{3})/;
while (rgx.test(x1)) {
x1 = x1.replace(rgx, '$1' + '.' + '$2');
}
@icetee
icetee / numeral-hu.js
Last active August 29, 2015 14:12
Numeral Hungarian language
/*!
* numeral.js language configuration
* language : Hungarian (hu)
* source : Peter Bakondy : https://github.com/pbakondy
* author : Horváth Tamás András
*/
(function () {
var language = {
delimiters: {
thousands: '.',
@icetee
icetee / bootstrap-modal-fix
Created January 7, 2015 16:13
Bootstrap modal - scroolbar fix
body.modal-open, .modal-open .modal-open {
margin-right: -15px;
}
@icetee
icetee / keydownnext
Created January 24, 2015 15:10
Keydown next
$('.inputs').keydown(function (e) {
if (e.which === 13) {
var index = $('.inputs').index(this) + 1;
$('.inputs').eq(index).focus();
}
});
@icetee
icetee / acf-google-map.js
Last active August 29, 2015 14:22
acf-google-map.js added "set zoom" feature
(function ($) {
function render_map($el) {
var $markers = $el.find('.marker');
// Add custom data-zoom
window.gmapzoom = parseInt($markers.attr('data-zoom'));
if ( isNaN(window.gmapzoom) ) { window.gmapzoom = 16; }
@icetee
icetee / pll_change_language_nav.js
Last active August 29, 2015 14:23
Create polylang dropdown nav + remove old element
(function pll_change_language_nav() {
var $lang = $('html').attr('lang');
var $navbar = $('.navbar-nav');
var $navitem = 'li.lang-item';
var $changelang = "";
var lang = {};
if ( !$navbar.find($navitem).hasClass( "pll-lang" ) ) {
<?php
/*
* A walker class to use that extends wp_dropdown_categories and allows it to use the term's slug as a value rather than ID.
*
* See http://core.trac.wordpress.org/ticket/13258
*
* Usage, as normal:
* wp_dropdown_categories($args);
*
@icetee
icetee / wp_get_custom_categories.php
Last active August 29, 2015 14:23
get_custom_categories() in WordPress
function get_custom_categories($slug) {
$args = array(
'hide_empty' => 1,
'orderby' => 'name',
'show_count' => 0,
'pad_counts' => 0,
'hierarchical' => 1,
'taxonomy' => $slug,
'title_li' => '',
@icetee
icetee / wp_remove_a_tag.php
Created June 22, 2015 08:19
remove_a_tag() in Wordpress
function remove_a_tag($string, $postid, $slug = true) {
$return = array();
preg_match_all("/<a.*?>(.*?)<\/a>/", $string, $matches);
foreach ($matches[1] as $key => $value) {
if ($slug == true) {
$return[] = sanitize_title($value);