Skip to content

Instantly share code, notes, and snippets.

View sortofsleepy's full-sized avatar

Joe sortofsleepy

View GitHub Profile
@sortofsleepy
sortofsleepy / Infinite sine wave
Last active August 29, 2015 14:17
A attempt at making a sine wave draw continuously. Nearly there! but needs a bit of work.
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet" href="rStats.css"/>
<style>
canvas{
position: absolute;
/**
* A THREE.js representation of a SVG. Can convert
* SVG shapes into THREE.Mesh(s).
*
* TODO two.js integration may prove unnecessary later. Also, it's unclear how complex SVGs will look.
*
* Also note - things might not line up exactly, subtract 1/2 viewbox width/height from position
* to get the proper 0,0 position
*
* @param shapeid id of the svg or (later on down the line)path to svg
@sortofsleepy
sortofsleepy / canvasText.js
Last active March 26, 2016 03:28
Converts copy you write in a canvas 2D context to an array of THREE.Vector2s (but could easily be modded to just return a regular array)
/**
* Simple class for quickly creating positions
* for use in a mesh or for whatever other purpose you might want.
*/
class TypeBuilder {
constructor(string="Hello",width=140,height=100){
this.canvas = document.createElement("canvas");
this.canvas.width = width;
this.canvas.height = height;
this.canvas.style.cssText = "position:relative;z-index:999"
@sortofsleepy
sortofsleepy / demo.cljs
Created April 4, 2016 04:48
thi.ng demo - just saving some test code for reference
(ns ribbon-attractor.demo
(:require
[matchstick.Geometry :as mgeo]
[matchstick.custom-geometry.Plane :as pgeo]
[matchstick.SimpleGeometry :as sgeo]
[thi.ng.geom.mesh.polyhedra :as poly]
[thi.ng.glsl.core :as glsl :include-macros true :refer-macros [defglsl]]
[thi.ng.math.core :as m :refer [PI HALF_PI TWO_PI]]
[thi.ng.geom.webgl.constants :as glc]
[thi.ng.geom.webgl.animator :as anim]
@sortofsleepy
sortofsleepy / app.clj
Last active May 23, 2016 01:27
working with Processing in clojure (assumes Processing jars have been imported / specified on project.clj)
(ns processing-test.core
(:gen-class)
(:require
[processing-test.sketch :as sk])
(:import
[processing.core PApplet]))
(defn -main
"I don't do a whole lot ... yet."
[& args]
#include "cinder/app/App.h"
#include "cinder/app/RendererGl.h"
#include "cinder/Rand.h"
#include "cinder/gl/gl.h"
using namespace ci;
using namespace ci::app;
using namespace std;
@sortofsleepy
sortofsleepy / webpack.config.js
Created January 24, 2017 18:42
Shows webpack 2 hot reload working (adjust as necessary)
// configuration. Pass in your the path to your own file or it defaults to a default one
config = {
entry: default_entries,
performance:{
hints:false
},
output:{
path:OUTPUT,
filename:"app.js",
@sortofsleepy
sortofsleepy / test.py
Last active April 25, 2017 16:23
keras-test
from keras.layers import Lambda
from keras.models import Sequential
from keras.optimizers import RMSprop
# declares toy model that just multiplies input by 2
def mult(x):
return x * 2
# declare sequential layer
vec3 calcRayIntersection( vec3 pos )
{
vec3 retPos = pos;
if (rayPosition.x > pos.x - 1 &&
rayPosition.x < pos.x + 1 &&
rayPosition.y > pos.y - 1 &&
rayPosition.y < pos.y + 1 &&
rayPosition.z > pos.z - 1 &&
rayPosition.z < pos.z + 1 &&
connection[0] != -1 && connection[1] != -1 &&
fragment float4 capturedImageFragmentShader(ImageColorInOut in [[stage_in]],
texture2d<float, access::sample> capturedImageTextureY [[ texture(kTextureIndexY) ]],
texture2d<float, access::sample> capturedImageTextureCbCr [[ texture(kTextureIndexCbCr) ]]) {
constexpr sampler colorSampler(mip_filter::linear,
mag_filter::linear,
min_filter::linear);
const float4x4 ycbcrToRGBTransform = float4x4(
float4(+1.0000f, +1.0000f, +1.0000f, +0.0000f),