Skip to content

Instantly share code, notes, and snippets.

View vanaf1979's full-sized avatar

VA79 vanaf1979

View GitHub Profile
@vanaf1979
vanaf1979 / parseBool.js
Created July 16, 2017 13:37
Parse a velue to a bool
function parseBool( value )
{
return value == "true" || value == true || value == 1 ? true : false;
}
@vanaf1979
vanaf1979 / inArray.js
Created July 16, 2017 13:38
Is a value present in a givven array
function inArray( needle , haystack )
{
for( var i = 0 ; i < haystack.length ; i++ )
{
if( haystack[i] == needle ) return i;
}
return -1;
}
@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-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 / 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 / enqueue-scripts-partial.php
Last active March 19, 2019 10:11
Gist for my "WordPress: Laravel Mix, Sass and ES6 Modules in theme development" tutorial at Medium http://bit.ly/wplaravelmixtut
<?php
function mix_tutorial_enqueue_scripts() {
$theme = wp_get_theme();
wp_enqueue_script( $theme->get('TextDomain') . '-manifest' , get_template_directory_uri() . '/public/js/manifest.js' , array() , $theme->get('Version') , true );
wp_enqueue_script( $theme->get('TextDomain') . '-vendor' , get_template_directory_uri() . '/public/js/vendor.js' , array() , $theme->get('Version') , true );
wp_enqueue_script( $theme->get('TextDomain') . '-app' , get_template_directory_uri() . '/public/js/app.js' , array() , $theme->get('Version') , true );
}