Skip to content

Instantly share code, notes, and snippets.

View robertleeplummerjr's full-sized avatar

Robert Plummer robertleeplummerjr

View GitHub Profile
@robertleeplummerjr
robertleeplummerjr / indexOfNearestLessThan.js
Last active January 4, 2023 18:41
Ultra performant binary search to find nearest less than a value
function indexOfNearestLessThan(array, needle) {
if (array.length === 0) return -1;
var high = array.length - 1,
low = 0,
mid,
item,
target = -1;
if (array[high] < needle) {
@robertleeplummerjr
robertleeplummerjr / index
Created February 9, 2015 16:39
stencila#3
<!DOCTYPE html>
<html>
<head>
<script src="https://raw.githubusercontent.com/jakiestfu/Medium.js/master/medium.js"></script>
<link href="https://raw.githubusercontent.com/jakiestfu/Medium.js/master/medium.css" type="text/css"/>
<style>
.green {
background-color: green;
}
</style>
@robertleeplummerjr
robertleeplummerjr / iframe.html
Created February 12, 2015 17:02
Medium.js with IFrame
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>Medium.js with an Iframe</title>
<script src="bower_components/undo/undo.js"></script>
<script src="bower_components/rangy-official/rangy-core.min.js"></script>
<script src="bower_components/rangy-official/rangy-classapplier.min.js"></script>
<script src="medium.js"></script>
<link href="medium.css" rel="stylesheet">
@robertleeplummerjr
robertleeplummerjr / anchor.html
Created February 17, 2015 02:21
Medium.js with Anchor
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>Medium.js to make an Anchor</title>
<script src="bower_components/undo/undo.js"></script>
<script src="bower_components/rangy-official/rangy-core.min.js"></script>
<script src="bower_components/rangy-official/rangy-classapplier.min.js"></script>
<script src="medium.js"></script>
<link href="medium.css" rel="stylesheet">
@robertleeplummerjr
robertleeplummerjr / issue.js
Created March 18, 2015 20:22
Infamous merging issue in jQuery.sheet
var div = $('<div>')
.appendTo('body')
.append(tableify(' \t \t \t \t \n\
\t \t \t \t \n\
\t \t \t \t \n\
\t \t \t \t \n\
\t \t \t \t \n'))
.append(tableify(' \t \t \t \t \n\
\t \t \t \t \n\
\t \t \t \t \n\
//depends on https://github.com/padolsey/operative
var jsonThreadedStreamer = (function (operative) {
var i = 0,
threads = [];
function thread() {
var t = threads[i],
limit = thread.limit;
@robertleeplummerjr
robertleeplummerjr / RequestListener.js
Created October 29, 2015 14:34
XMLHttpRequest Listener
var XMLHttpRequest = window.XMLHttpRequest;
function RequestListener(objParameters) {
var self = this
, realRequest = this.realRequest = new XMLHttpRequest(objParameters)
;
realRequest.onload = function() {
if (self.onload) {
self.onload.apply(realRequest, arguments);
@robertleeplummerjr
robertleeplummerjr / README.md
Last active November 26, 2015 14:35 — forked from dustinlarimer/README.md
Ant Colony Optimization in D3.js

Crude implementation of ACO in D3js, based on the awesome work of Joel Wenzel et al.

@robertleeplummerjr
robertleeplummerjr / index.html
Last active March 22, 2021 22:40
Many polygons with leaflet experiment upgrade to latest earcut
<!doctype html>
<html>
<head>
<title>Many polygons with leaflet, earcut and WebGL</title>
<meta charset="utf-8">
<style>
html, body {
height: 100%;
padding: 0;
var fs = something(require('fs'));
fs.readFile('')
.then(function(str) {})
.then(function() {})
.done(function() {})
.error(function (err) {
//this is an optional fn that is already defined to throw the error, but can be overridden