Skip to content

Instantly share code, notes, and snippets.

View davidvandenbor's full-sized avatar

David van den Bor davidvandenbor

View GitHub Profile
@davidvandenbor
davidvandenbor / html5shiv_ie8_foundation.html
Last active August 29, 2015 14:07
html5shiv IE8 conditional for Foundation 5
<head>
<!--Make IE8 use rems CSS the Foundation CSS grid, and be responsive with Foundation 5-->
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.6.2/html5shiv.js"></script>
<script src="//s3.amazonaws.com/nwapi/nwmatcher/nwmatcher-1.2.5-min.js"></script>
<script src="//html5base.googlecode.com/svn-history/r38/trunk/js/selectivizr-1.0.3b.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.1.0/respond.min.js"></script>
<![endif]-->
<!-- Another example, this time "feeding" different files to IE8 and IE9 -->
@davidvandenbor
davidvandenbor / functions.php
Last active August 29, 2015 14:10
WordPress: Add buttons to WordPress HTML editor
<?php
/**
* -------------------------------------------------------------------------------//
* Add buttons to WordPress HTML editor
* @author @david
* -------------------------------------------------------------------------------//
*/
function appthemes_add_quicktags() {
?>
<script type="text/javascript">
@davidvandenbor
davidvandenbor / seo-social-media-meta-tags.html
Last active May 19, 2024 13:09
SEO Social Media Meta Tags
<!-- SEO / Google -->
<meta name="author" content="Author name here....">
<meta name="description" content="Description text here.....">
<link rel="canonical" href="URL here...">
<!-- Social: Twitter -->
<!-- After inserting META need to validate at https://dev.twitter.com/docs/cards/validation/validator -->
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@8bit_code">
<meta name="twitter:creator" content="8bit_code">
@davidvandenbor
davidvandenbor / bootstrap-blockgrid-usage.html
Last active August 29, 2015 14:16
Bootstrap Block grid from Zurb Foundation
<div class="container">
<div class="block-grid-lg-4 block-grid-md-3 block-grid-sm-2">
<div class="block-grid-item">
<h1>User 1</h1>
</div>
<div class="block-grid-item">
<h1>User 2</h1>
</div>
<div class="block-grid-item">
<h1>User 3</h1>
@davidvandenbor
davidvandenbor / jquery-scrolldown-button.js
Last active August 29, 2015 14:17
Jquery Javascript Scrolldown Button
$(document).ready(function(){
// button is the ID (or use class, like so '.button') of the object that triggers the scrolling
$('#button').on('click',function(){
// in this case, '#content' is the ID that is being scrolled to
$('html, body').animate({scrollTop: $("#content").offset().top}, 1400);
});
});
@davidvandenbor
davidvandenbor / smooth-scrolling-page-links.js
Last active February 15, 2017 11:31
Smooth scrolling to in-page links
@davidvandenbor
davidvandenbor / change-posts-to-news.php
Last active August 29, 2015 14:18
WordPress: change Post type "posts" to "news" in WP admin
<?php
// Change "Posts" to "News" in the admin.
add_action( 'admin_menu', 'intranet_rename_post_to_news_menu' );
add_action( 'init', 'intranet_rename_post_to_news' );
function intranet_rename_post_to_news_menu() {
global $menu, $submenu;
$menu[5][0] = 'News';
@davidvandenbor
davidvandenbor / featured-image-rss-feed.php
Last active August 29, 2015 14:20
Add featured image to RSS feed
@davidvandenbor
davidvandenbor / add-css-to-html-jquery.js
Created May 1, 2015 12:19
Add CSS code or classes to html elements with jQuery
// @david: add or remove classes at certain scrolling distances
// the class names in this gist are meant as an example :-)
$(window).scroll(function() {
var y_scroll_pos = window.pageYOffset;
var scroll_pos_test = 300;
// set to whatever you want it to be
if (y_scroll_pos > scroll_pos_test) {
$(".menu").addClass("animated fadeInLeft");
// or add or remove pure CSS code:
@davidvandenbor
davidvandenbor / grav-cms-twig-loops.twig
Last active November 6, 2019 07:00
GRAV cms TWIG loops
{# find the children (subpages) of a parent page, in this case the "about" page #}
<ul>
{% for p in page.find('/about').children if p != page %}
<li><a href="{{p.url}}">{{ p.title }}</a></li>
{% endfor %}
</ul>
{# show all the pages with a certain category, in this case "cars" #}
<h2>All the CAR posts</h2>
<ul>