Skip to content

Instantly share code, notes, and snippets.

@alegut
alegut / oop.php
Created February 3, 2018 20:40
Object oriented programmong examples
<?php
//Class ShoppingCard {
//
//}
//
//$product1 = new ShoppingCard();
//$product2 = new ShoppingCard();
//$product3 = new ShoppingCard();
//
@alegut
alegut / geocoding.html
Created March 12, 2018 16:38
Geocoding Google Maps
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>Google Maps JavaScript API v3 Example: Geocoding Simple</title>
<style>
html, body, #map_canvas {
height: 100%;
@alegut
alegut / enqueue.php
Created March 12, 2018 16:42
WordPress styles and scripts including
<?php
function my_plugin_add_scripts(){
wp_enqueue_style('my-plugin-style', plugins_url().'/my-plugin/css/style.css');
wp_enqueue_script('my-plugin-script', plugins_url().'/my-plugin/js/main.js');
}
add_action('wp_enqueue_scripts', 'my_plugin_add_scripts');
@alegut
alegut / validateurl.js
Created April 2, 2018 08:00
JS validate URL
function validateUrl(url) {
var re = /^(ftp|http|https):\/\/[^ "]+$/.test(url);
return re;
}
function validate(data) {
var url = data.val();
var $result = data.next();
$result.text("");
@alegut
alegut / everyevenodd.php
Created April 2, 2018 08:08
Every add and even element in one loop
for ($i=1; $i+1< count($menu_param); $i+=2) {
$output .= '<li class="menu-item"><a title="'.$menu_param[$i].'" href="'.$menu_param[$i+1].'" target="_blank">'.$menu_param[$i].'</a></li>';
}
@alegut
alegut / columns.css
Created May 24, 2018 14:07
CSS columns and avoid
.ko_menu_slider .owl-wrapper .inner_slide {
-webkit-column-count: 2; /* Chrome, Safari, Opera */
-moz-column-count: 2; /* Firefox */
column-count: 2;
}
.ko_menu_slider .owl-wrapper .inner_slide div{
-webkit-column-break-inside: avoid;
page-break-inside: avoid;
break-inside: avoid;
@alegut
alegut / outline.css
Created May 24, 2018 14:08
Avoid outline on active links
#logoSocial a:active,
#logoSocial a:focus {
outline: 0;
border: none;
-moz-outline-style: none;
}
@alegut
alegut / cssSlider.html
Created May 25, 2018 13:58
Css slider animate, no controls
<div class="container">
<img class='photo' src="http://farm9.staticflickr.com/8320/8035372009_7075c719d9.jpg" alt="" />
<img class='photo' src="http://farm9.staticflickr.com/8517/8562729616_35b1384aa1.jpg" alt="" />
<img class='photo' src="http://farm9.staticflickr.com/8465/8113424031_72048dd887.jpg" alt="" />
<img class='photo' src="http://farm9.staticflickr.com/8241/8562523343_9bb49b7b7b.jpg" alt="" />
</div>
body {
background: #000;
}
@alegut
alegut / detect-scroll-to-bottom.js
Last active September 7, 2018 10:25
Detect scroll to bottom
$(window).scroll(function() {
if($(window).scrollTop() + $(window).height() == $(document).height()) {
alert("bottom!");
}
});
@alegut
alegut / hide-am-pm.css
Created June 15, 2018 13:49
Hide AM/PM in input type="time"
input[type=time]::-webkit-datetime-edit-ampm-field {
display: none;
}