Skip to content

Instantly share code, notes, and snippets.

View funnylookinhat's full-sized avatar

David Overcash funnylookinhat

View GitHub Profile
@funnylookinhat
funnylookinhat / rbgaconvert.js
Last active December 28, 2015 05:19
RGBA Convert: Using RGBA pixels from images to create a wide array of heightmap values.
/**
* RGBA Convert
* Converting RGBA values to/from heightmap values ( i.e. signed "3 decimal" numbers )
* Expected range +/- 999999.999
*/
function convertToRGBA(value) {
value = parseInt(1000 * (parseFloat(value).toFixed(3)));
var a = value & 255; value = value >>> 8;
var b = value & 255; value = value >>> 8;
@funnylookinhat
funnylookinhat / new_gist_file
Last active December 27, 2015 04:09
lmg grid overlay
uniform vec2 gridSize;
const vec4 gridColor = vec4(1.0,0.5,0.0, 0.1);
const float gridLineWidth = 0.03;
const float gridLineFade = 0.01;
// overlay grid
vec2 xy = vUv * gridSize;
vec2 dGrid = abs(xy - floor(xy+0.5)); // floor(i+0.5) == round
vec2 d = min( 2.0 * abs(dGrid) - (gridLineWidth/2.0 - gridLineFade), gridLineFade) / gridLineFade;
gl_FragColor.rgb = mix( gl_FragColor.rgb, gridColor.rgb, (1.0 - min(d.x,d.y)) * gridColor.a );
@funnylookinhat
funnylookinhat / tracking.md
Last active December 26, 2015 09:09
Tracking code regexps

###UPS

/\b(1Z ?[0-9A-Z]{3} ?[0-9A-Z]{3} ?[0-9A-Z]{2} ?[0-9A-Z]{4} ?[0-9A-Z]{3} ?[0-9A-Z]|[\dT]\d\d\d ?\d\d\d\d ?\d\d\d)\b/

###FEDEX

/(\b96\d{20}\b)|(\b\d{15}\b)|(\b\d{12}\b)/
header('Access-Control-Allow-Origin: '.$_SERVER['HTTP_ORIGIN']);
header('Access-Control-Allow-Methods: GET, PUT, POST, DELETE, OPTIONS');
header('Access-Control-Max-Age: 1000');
header('Access-Control-Allow-Headers: Content-Type, Authorization, X-Requested-With');
@funnylookinhat
funnylookinhat / replace_url.php
Created April 17, 2013 18:16
RegEXP Find / Replace URLs with Links
<?php
// RegEXP
// @(https?://([-\w\.]+[-\w])+(:\d+)?(/([\w/_\.#-\+]*(\?\S+)?[^\.\s])?)?)@
$string = "Whatever!";
$new_string = preg_replace('@(https?://([-\w\.]+[-\w])+(:\d+)?(/([\w/_\.#-\+]*(\?\S+)?[^\.\s])?)?)@', '<a href="$1" target="_blank">$1</a>', $string );
[playlist]
NumberOfEntries=4
File1=http://slacker.cvgm.net:8000/cvgm128
File2=http://relay3.slayradio.org:8000/
File3=http://radio.modules.pl:8500/
File4=http://audio.misproductions.com:80/japan128k
@funnylookinhat
funnylookinhat / interfaces
Last active December 15, 2015 14:19
VirtualBox Devstack setup...
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet dhcp
@funnylookinhat
funnylookinhat / ColladaLoader.js
Created March 13, 2013 20:03
ColladaLoader.js
/**
* @author Tim Knip / http://www.floorplanner.com/ / tim at floorplanner.com
*/
THREE.ColladaLoader = function () {
var COLLADA = null;
var scene = null;
var daeScene;
@funnylookinhat
funnylookinhat / gist:5062061
Last active December 14, 2015 08:59
tree.js
{
"metadata" :
{
"formatVersion" : 3.1,
"generatedBy" : "Blender 2.65 Exporter",
"vertices" : 8637,
"faces" : 4778,
"normals" : 8242,
"colors" : 3,
@funnylookinhat
funnylookinhat / OldStaticQuadTree
Created January 28, 2013 17:30
Comparing two class definitions for NodeJS exports.
/**
* Static Quad Tree
* This is a one-way tree that only allows insertion for maximum efficiency.
* @author David Overcash <funnylookinhat@gmail.com>
* Credit to https://github.com/mikechambers/ExamplesByMesh for a great example.
*/
(function(exports) {
var Node = (function (constructParams) {
var _MAX_ITEMS = 4;