Skip to content

Instantly share code, notes, and snippets.

View vanaf1979's full-sized avatar

VA79 vanaf1979

View GitHub Profile
@vanaf1979
vanaf1979 / removeEvent.js
Created July 16, 2017 13:43
Remove an event listner
function removeEvent( ellement , type , callback )
{
if ( ellement.detachEvent )
{
ellement.detachEvent( 'on' + type , callback );
}
else
{
ellement.removeEventListener( type , callback );
}
@vanaf1979
vanaf1979 / triggerEvent.js
Created July 16, 2017 13:44
Trigger a event
function triggerEvent( ellement , type )
{
if ( 'createEvent' in document )
{
var e = document.createEvent( 'HTMLEvents' );
e.initEvent( type , false , true );
ellement.dispatchEvent( e );
}
else
{
@vanaf1979
vanaf1979 / depend.js
Created July 16, 2017 13:47
Run code after a dependancy has been injected into the page
function depend( url , callback )
{
var script = document.createElement( 'script' );
var scripts = document.getElementsByTagName( 'script' )[0];
script.async = true;
script.onload = function()
{
script.onload = null;
callback();
}
@vanaf1979
vanaf1979 / Basic-va-gmap-with-single-marker.html
Last active December 28, 2017 20:39
Basic gmap with single marker
<gmap data-lat='12.3456789' data-lan='2.345678' data-zoom='17' data-type='roadmap'>
<marker data-lat="12.3456789" data-lan="2.345678" data-open="true">
<h4>Company name</h4>
<p>Here goes a company description</p>
</marker>
</gmap>
@vanaf1979
vanaf1979 / Basic-va-gmap-with-multiple-markers-and-auto-center.html
Last active December 28, 2017 20:40
Basic va-gmap with multiple markers and auto center
<gmap data-type='roadmap' data-mapAutoCenter='true'>
<marker data-lat="12.3456789" data-lan="2.345678">
<h4>Company name</h4>
<p>Here goes a company description</p>
</marker>
<marker data-lat="13.3456789" data-lan="3.345678">
@vanaf1979
vanaf1979 / va-typography.css
Created January 6, 2018 21:02
Css helper file to get your typography to behave.
/*
-- VA79 Typography
*/
html, body {
font-family: 'Open Sans', Helvetica, sans-serif;
font-size: 15px;
}
* {
font-family: 'Open Sans', Helvetica, sans-serif;
@vanaf1979
vanaf1979 / wordpress-htaccess.txt
Last active January 7, 2018 19:51
Compression, Expiration and Cache control Htaccess rules to speed up Wordpress
#
### HTACCESS RULES TO SPEED UP WORDPRESS
#
### / START DEFLATE COMPRESSION
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
@vanaf1979
vanaf1979 / wp-basics-simple-nav.php
Last active December 12, 2018 10:49
Echo a basic wordpress menu
/* Echo a basic wordpress menu */
<?php wp_page_menu('show_home=Home&menu_class=mainmenu&sort_column=menu_order&exclude=00,00&depth=0&exclude_tree=00,00'); ?>
@vanaf1979
vanaf1979 / wp-basics-simple-nav-readable.php
Last active December 12, 2018 10:48
Echo a basic wordpress menu (readable version)
/* Echo a basic wordpress menu */
<?php
$args = array(
'depth' => 0,
'sort_column' => 'menu_order',
'menu_class' => 'mainmenu',
'include' => '',
'exclude' => '',
@vanaf1979
vanaf1979 / functions-styles-scripts-hook.php
Last active January 3, 2020 19:57
Add a action to enqueue stylesGist for my "WorpdPress: Css Styles and Javascripts in theme development (In depth)" article: https://since1979.dev/wordpress-css-styles-and-javascripts-in-theme-development-in-depth/
<?php
/* Add a action to enqueue styles */
function my_theme_enqueue_styles()
{
}
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
?>