Skip to content

Instantly share code, notes, and snippets.

View NickStees's full-sized avatar

Nicholas S NickStees

View GitHub Profile
@gormus
gormus / FilterLazyload.php
Last active October 26, 2020 15:09
bLazy for Drupal 8
<?php
// This plug needs to be placed in a custom module:
// `modules/custom/YOURMODULE/src/Plugin/Filter/FilterLazyload.php`
namespace Drupal\YOURMODULE\Plugin\Filter;
use Drupal\Component\Utility\Html;
use Drupal\filter\FilterProcessResult;
use Drupal\filter\Plugin\FilterBase;
@xincici
xincici / throttle-debounce
Created May 29, 2015 08:25
throttle and debounce functions extracted from underscore.js
(function(){
var _ = {};
_.now = Date.now || function(){
return new Date().getTime();
};
// Returns a function, that, when invoked, will only be triggered at most once
// during a given window of time. Normally, the throttled function will run
// as much as it can, without ever going more than once per `wait` duration;
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"