Skip to content

Instantly share code, notes, and snippets.

@rutger1140
rutger1140 / _crossfade.scss
Last active May 16, 2018 15:25
SASS mixin for crossfading elements
//
// SASS mixin for crossfading elements
//
// Usage:
//
// .element {
// @include crossfade($num: 2, $fade: 5, $visible: 0);
//
// left: 0;
// opacity: 0;

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:

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rutger1140
rutger1140 / run-in-console.js
Last active September 27, 2016 13:42
Spotify total cost
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));
@rutger1140
rutger1140 / functions.php
Created September 19, 2016 12:25
WordPress disable search
<?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
@rutger1140
rutger1140 / run-in-console.js
Created August 4, 2016 07:34
Beanstalk total costs
var t = 0;
$(".invoices-list a").each(function() {
t += parseFloat($(this).text().substring(1))
});
console.log(t);
@rutger1140
rutger1140 / parsevideo.js
Created June 10, 2016 15:09
Parse video url for YouTube and Vimeo - finds video ID
// 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
@rutger1140
rutger1140 / sample.less
Last active May 18, 2016 13:02
LESS to SASS conversion - issue
// LESS
.form-field {
border: 1px solid #ccc;
padding: .5em 1em;
input& {
height: 2em;
}
textarea& {
height: auto;
}
@rutger1140
rutger1140 / function.php
Last active October 24, 2017 13:28
Get link to other language for post in MultilingualPress (MLP) WordPress plugin
<?php
// Usage
// $linked = lwp_get_language_link($siteid, $postid);
// $link = $linked['link'];
// $title = $linked['title'];
// Return
// array['link'] for link to post
@rutger1140
rutger1140 / clickable.js
Created January 29, 2016 14:26
Simple javascript helper to find link element in block and follow link on click
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;