Skip to content

Instantly share code, notes, and snippets.

Douglas Duhaime duhaime

Block or report user

Report or block duhaime

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@duhaime
duhaime / OrbitControls.js
Last active Aug 20, 2019
Low-Poly Scene (Three.js)
View OrbitControls.js
/**
* @author qiao / https://github.com/qiao
* @author mrdoob / http://mrdoob.com
* @author alteredq / http://alteredqualia.com/
* @author WestLangley / http://github.com/WestLangley
*/
THREE.OrbitControls = function ( object, domElement ) {
this.object = object;
@duhaime
duhaime / plot-bunnies.ipynb
Last active Aug 1, 2019
plot-bunnies.ipynb
View plot-bunnies.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@duhaime
duhaime / dither.ipynb
Created Jul 30, 2019
Floyd-Steinberg Dithering
View dither.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@duhaime
duhaime / image-to-points.ipynb
Created Jul 30, 2019
Image to Points: Convert an input image to a series of discrete, uniform-sized points using simple statistical sampling
View image-to-points.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@duhaime
duhaime / download.py
Last active Jul 12, 2019
Download Yale Digital Collection Images
View download.py
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time, os, json, glob
if not os.path.exists('records'):
os.makedirs('records')
max_page_fetched = 0
for i in glob.glob('records/*.json'):
page = int(os.path.basename(i).split('-')[0])
View dat.gui.min.js
/**
* dat-gui JavaScript Controller Library
* http://code.google.com/p/dat-gui
*
* Copyright 2011 Data Arts Team, Google Creative Lab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@duhaime
duhaime / randomDarkColor.js
Created Jul 10, 2019
random dark color - javascript
View randomDarkColor.js
function randomDarkColor() {
var lum = -0.35;
var hex = String('#' + Math.random().toString(16).slice(2, 8).toUpperCase()).replace(/[^0-9a-f]/gi, '');
if (hex.length < 6) hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
var c, i, rgb = '#';
for (i = 0; i < 3; i++) {
c = parseInt(hex.substr(i * 2, 2), 16);
c = Math.round(Math.min(Math.max(0, c + (c * lum)), 255)).toString(16);
rgb += ('00' + c).substr(c.length);
}
@duhaime
duhaime / scroll-into-view.js
Last active Jul 2, 2019
Scroll Into View (via SO 17722497)
View scroll-into-view.js
(function() {
function currentYPosition() {
// Firefox, Chrome, Opera, Safari
if (self.pageYOffset) return self.pageYOffset;
// Internet Explorer 6 - standards mode
if (document.documentElement && document.documentElement.scrollTop)
return document.documentElement.scrollTop;
// Internet Explorer 6, 7 and 8
if (document.body.scrollTop) return document.body.scrollTop;
return 0;
@duhaime
duhaime / mongodb.conf
Created Jun 24, 2019
mongodb.conf default mongo mongodb config file
View mongodb.conf
# mongodb.conf
# Where to store the data.
# Note: if you run mongodb as a non-root user (recommended) you may
# need to create and set permissions for this directory manually,
# e.g., if the parent directory isn't mutable by the mongodb user.
dbpath=/var/lib/mongodb
#where to log
You can’t perform that action at this time.