Skip to content

Instantly share code, notes, and snippets.

@tobbbe
tobbbe / debounce.js
Created August 21, 2017 14:23 — forked from beaucharman/debounce.js
An ES6 implementation of the debounce function. "Debouncing enforces that a function not be called again until a certain amount of time has passed without it being called. As in 'execute this function only if 100 milliseconds have passed without it being called.'" - CSS-Tricks (https://css-tricks.com/the-difference-between-throttling-and-debounc…
function debounce(callback, wait, context = this) {
let timeout = null
let callbackArgs = null
const later = () => callback.apply(context, callbackArgs)
return function() {
callbackArgs = arguments
clearTimeout(timeout)
timeout = setTimeout(later, wait)
@tobbbe
tobbbe / gist:26595348fa4e4d3a5ecf
Last active May 4, 2018 11:57 — forked from nul800sebastiaan/gist:8641249
Umbraco route hijacking What's this Umbraco route hijacking all about? (more info in this blog post: http://cultiv.nl/blog/whats-this-umbraco-route-hijacking-all-about/)
// MODEL
using System.Collections.Generic;
using System.Linq;
using Umbraco.Core.Models;
using Umbraco.Web;
using Umbraco.Web.Models;
namespace Cultiv.Models
{
public class BlogOverview : RenderModel