Skip to content

Instantly share code, notes, and snippets.

Rutger lekkerduidelijk

View GitHub Profile
@lekkerduidelijk
lekkerduidelijk / _crossfade.scss
Last active May 16, 2018
SASS mixin for crossfading elements
View _crossfade.scss
//
// SASS mixin for crossfading elements
//
// Usage:
//
// .element {
// @include crossfade($num: 2, $fade: 5, $visible: 0);
//
// left: 0;
// opacity: 0;
View keybase.md

Keybase proof

I hereby claim:

  • I am lekkerduidelijk on github.
  • I am lekkerduidelijk (https://keybase.io/lekkerduidelijk) on keybase.
  • I have a public key ASBcKtkg_UxifVNciqpHn-WMDSEV2rN1CtAniJnJZUOicwo

To claim this, I am signing this object:

View gemeenten2015.json
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View run-in-console.js
var t = 0;
$(".receipt-price").each(function() {
// EU version - comma decimal separator
t += parseFloat($(this).text().substring(1).replace(',','.'));
// US version - dot decimal separator
// t += parseFloat($(this).text().substring(1));
});
console.log(t.toFixed(2));
@lekkerduidelijk
lekkerduidelijk / functions.php
Created Sep 19, 2016
WordPress disable search
View functions.php
<?php
// Add to your functions.php file
function disable_search( $query, $error = true ) {
if ( is_search() ) {
$query->is_search = false;
$query->query_vars[s] = false;
$query->query[s] = false;
// to error
View run-in-console.js
var t = 0;
$(".invoices-list a").each(function() {
t += parseFloat($(this).text().substring(1))
});
console.log(t);
@lekkerduidelijk
lekkerduidelijk / parsevideo.js
Created Jun 10, 2016
Parse video url for YouTube and Vimeo - finds video ID
View parsevideo.js
// Source: http://stackoverflow.com/a/22763925
function parseVideo(url) {
// - Supported YouTube URL formats:
// - http://www.youtube.com/watch?v=My2FRPA3Gf8
// - http://youtu.be/My2FRPA3Gf8
// - https://youtube.googleapis.com/v/My2FRPA3Gf8
// - Supported Vimeo URL formats:
// - http://vimeo.com/25451551
// - http://player.vimeo.com/video/25451551
@lekkerduidelijk
lekkerduidelijk / sample.less
Last active May 18, 2016
LESS to SASS conversion - issue
View sample.less
// LESS
.form-field {
border: 1px solid #ccc;
padding: .5em 1em;
input& {
height: 2em;
}
textarea& {
height: auto;
}
@lekkerduidelijk
lekkerduidelijk / function.php
Last active Oct 24, 2017
Get link to other language for post in MultilingualPress (MLP) WordPress plugin
View function.php
<?php
// Usage
// $linked = lwp_get_language_link($siteid, $postid);
// $link = $linked['link'];
// $title = $linked['title'];
// Return
// array['link'] for link to post
@lekkerduidelijk
lekkerduidelijk / clickable.js
Created Jan 29, 2016
Simple javascript helper to find link element in block and follow link on click
View clickable.js
function clickableBlock() {
// Each element with data-clickable is searched for an link and onclick
// the link is followed
$("[data-clickable]").each(function(){
var $this = $(this),
link = $this.find("a").attr("href");
if(link) {
$this.click(function(){
window.location = link;
You can’t perform that action at this time.