Skip to content

Instantly share code, notes, and snippets.

@leongersen
leongersen / index.html
Created December 10, 2016 11:19
Quick tool for automatically converting line-separated lists to comma-separated
<!DOCTYPE html>
<html style="height:100%">
<link href="style.css" rel="stylesheet">
<div>
<label>Totaal: <input id="yy" style="width:80px;"></label>
<label><input id="b" type="checkbox">'</label>
<label><input id="c" type="checkbox">"</label>
</div>
<textarea placeholder="paste here!" id="a"></textarea>
<script src="script.js"></script>
@leongersen
leongersen / fetch.html
Created November 5, 2015 22:16
URL finder using fetch and promises. Logs a list of URLs on a domain to the console.
<!DOCTYPE html>
<script>
// Do anything in this function.
function isOkForDomain (a) {
a = a.toLowerCase();
return a.indexOf('/booking/') === -1 &&
a.indexOf('/beschikbaarheden/') === -1 &&
a.indexOf('/reviews/') === -1 &&
a.indexOf('/prijzen/') === -1 &&
@leongersen
leongersen / TypeHint.js
Last active October 31, 2021 08:58
Proof of concept for adding type-hinting to JavaScript.
// Set testable values;
window.Type = {
Number: 1,
String: 'a',
Function: function(){}
}
// Add a hint method;
Function.prototype.hint = function(){
@leongersen
leongersen / nouislider-inline.js
Last active August 28, 2020 07:43
A small handler to initialize noUiSlider with inline attributes. Implementation is roughly inspired by, but not fully compatible to, the specification for input[type="range"]. Attributes with or without the 'data-' prefix will be handled.
(function(){
'use strict';
$('[data-slider]').each(function(){
function d(a,b){
return parseFloat(a.attr(b) || a.attr('data-'+b));
}