Skip to content

Instantly share code, notes, and snippets.

@maranomynet
maranomynet / jquery.ui.autocomplete.html.js
Created April 18, 2011 14:47
clone of Scott González' jQuery UI autocomplete html extensionn - with className support added
/*
* jQuery UI Autocomplete HTML Extension
*
* Copyright 2010, Scott González (http://scottgonzalez.com)
* Dual licensed under the MIT or GPL Version 2 licenses.
*
* http://github.com/scottgonzalez/jquery-ui-extensions
*/
(function( $ ) {
@maranomynet
maranomynet / throttlefn.js
Last active December 26, 2015 04:09
basic function throttling utility function
// returns a throttled function that never runs more than every `delay` milliseconds
// the returned function also has a nice .finish() method.
$.throttleFn = function (func, skipFirst, delay) {
if ( typeof skipFirst === 'number' )
{
delay = skipFirst;
skipFirst = false;
}
delay = delay || 50;
var throttled = 0,
@maranomynet
maranomynet / array.sortISL.js
Last active May 29, 2016 15:01
Sort an array
/*
array.sortISL.js -- (c) 2014 Hugsmiðjan ehf. - MIT/GPL
Written by Már Örlygsson - http://mar.anomy.net
Original at: https://gist.github.com/maranomynet/9972930
Install via npm:
npm install gist:9972930
Use with CommonJS:
@maranomynet
maranomynet / sort-mithril-routes.js
Last active August 29, 2015 14:22
Sorting mithril-style routes logically
// https://gist.github.com/maranomynet/b3070a9aa08219566508
var _sortRoutes = function ( routes ) {
var sortedRoutes = {};
var tokens = {};
var tokenize = function (str) {
var token = tokens[str];
if ( token == null )
{
token = tokens[str] = str
// Sort order: ? < n < s < v < …
@maranomynet
maranomynet / mithril-mu.md
Last active August 29, 2015 14:25
Feature wrapper for Mithril.js
@maranomynet
maranomynet / thisamericanlive-archive.js
Last active July 7, 2021 17:36
This American Life - RSS Archive Builder
// Usage:
// 1. Visit http://www.thisamericanlife.org/radio-archives
// 2. Paste this script into the developer console of your browser.
// 3. Wait...
// 4. Copy-paste the resulting XML into a file.
//
(function(){
var jQuery = window.jQuery;
var doc = document;
@maranomynet
maranomynet / README.md
Last active April 19, 2017 16:42
Minimal Stylus setup

Einfalt Stylus setup

Þú þarft að vera búinn að installa nodejs. (Yfirleitt öruggast að velja nýjustu LTS útgáfuna, því allra, allra nýjasta nýjasta útgáfa er stundum pínu experimental og bögguð.)

Búa til nýtt verkefni.

cd myprojectfolder
npm init
@maranomynet
maranomynet / isValidKennitala.js
Created February 19, 2018 23:23
Simple JavaScript module to validate Icelandic kennitalas
export default function isValidKennitala(kt) {
// Trim and remove optional "-" or " " separators
kt = kt.trim().replace(/\s|-/, '');
// Alternatively only allow separator as 7th character
// kt = kt.replace(/^(.{6})[\s-]/, '$1');
// Must be 10 digits, ending in either 0 or 9 (note Y2.1k problem!)
if ( kt.length !== 10 && !/^\d{9}[90]$/.test(kt) ) {
return false;
}
@maranomynet
maranomynet / extinction-rebellion-logo.svg
Last active April 24, 2019 23:16
Extinction Logo (w. flair)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.