Skip to content

Instantly share code, notes, and snippets.

@BruOp
BruOp / separating_axis_culling.hpp
Created February 9, 2021 18:18
Separate Axis culling
struct OBB
{
vec3 center = {};
vec3 extents = {};
// Orthonormal basis
union
{
vec3 axes[3] = {};
};
@BruOp
BruOp / State Management.md
Last active February 21, 2018 18:05
State Management Ideas

State Management

Reading this, keep in mind this is the result of reading a lot of the Redux FAQ and some related blog posts from Abramov et al so theres a very good chance we'll need to tweak these guidelines going forward.

Additionally, there are some solutions that I'm not totally sold on, but we'll have to pick something and then iterate on it.

Goals

  1. Consistent structure to reduce the mental overhead of adding new actions, reducers and sagas
  2. Normalize all our "entity" data to make sure we are storing data on the front end in a consistent way
@BruOp
BruOp / IceMaterial.js
Created September 28, 2017 20:23 — forked from mattdesl/IceMaterial.js
fast subsurface scattering in ThreeJS PBR material — see "TRANSLUCENCY" in the frag shader
const glslify = require('glslify');
const path = require('path');
const assign = require('object-assign');
const defined = require('defined');
// This is the original source, we will copy + paste it for our own GLSL
// const vertexShader = THREE.ShaderChunk.meshphysical_vert;
// const fragmentShader = THREE.ShaderChunk.meshphysical_frag;
// Our custom shaders
@BruOp
BruOp / orientation_controls.js
Last active September 27, 2017 18:17
Orientation Controls
/**
* @author richt / http://richt.me
* @author WestLangley / http://github.com/WestLangley
*
* W3C Device Orientation control (http://w3c.github.io/deviceorientation/spec-source-orientation.html)
*/
import * as THREE from 'three';
function calcAngle(angle, offset = 0) {
if (!!angle) {
@BruOp
BruOp / auth_middleware
Created July 18, 2017 01:32
Absinthe Auth
defmodule Api.Graphql.AuthMiddleware do
@behaviour Absinthe.Middleware
def call(resolution, _config) do
case resolution.context[:authenticated] do
true -> resolution
_ -> Absinthe.Resolution.put_result(resolution, {:error, "Unauthorized"});
end
end
end
@BruOp
BruOp / gis_joins_guide.md
Last active February 1, 2020 01:37
A Guide on Performing Spatial Joins with QGIS

A Guide to Spatial Joins in QGIS

In order to perform a spatial join for a set of points in QGIS, there are a few steps you may need to take care of before performing the join itself.

Download QGIS

Download QGIS

Create a New Project and Add Your Layers

@BruOp
BruOp / JobWorkerPool.ex
Last active March 14, 2017 16:11
Elixir GenStage Example
require Logger
defmodule JobWorkerPool do
def start_link(worker_count, subscribe_options) do
# Start the producer
{:ok, producer_pid} = GenStage.start_link(__MODULE__.JobProducer, :ok)
# Override consumer subscribe options
@BruOp
BruOp / app.scss
Created August 5, 2016 19:56
Phoenix/Brunch @extend problems
/* This file is for your main application css. */
#some-div {
@extend .blue
}
@BruOp
BruOp / .gitignore
Last active August 29, 2015 14:23 — forked from mbostock/.block
.DS_Store
build
node_modules
Makefile
@BruOp
BruOp / gist:44c60f9039a8647e8621
Last active August 29, 2015 14:22
arrayOfLight
function arrayOfLight(x) {
var arr = new Array(x+1)
for (var i = 0; i <= x; i++) {
arr[i] = i;
}
return arr;
};