Skip to content

Instantly share code, notes, and snippets.

Greg Berger gregberger

Block or report user

Report or block gregberger

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
@sneha-belkhale
sneha-belkhale / Fbm.cginc
Last active Nov 3, 2019
Fractal Brownian Motion function to include in Unity Shader
View Fbm.cginc
float hash (float2 n)
{
return frac(sin(dot(n, float2(123.456789, 987.654321))) * 54321.9876 );
}
float noise(float2 p)
{
float2 i = floor(p);
float2 u = smoothstep(0.0, 1.0, frac(p));
float a = hash(i + float2(0,0));
@xem
xem / readme.md
Last active Nov 11, 2019
Maths & trigonometry cheat sheet for 2D & 3D games
View readme.md

Conventions

  • A = [xA, yA] is a point on the 2D plane. Same for B, C, ...
  • lengths are in any unit (ex: pixels)
  • code snippets are in JavaScript

Degrees to radians

angleRad = angleDeg * Math.PI / 180;

View colour_ring.pde
// by davey whyte aka @beesandbombs
void setup(){
size(600,520,P3D);
colorMode(HSB,1);
noStroke();
}
float R = 160, r = 55;
int N = 720;
@Pierstoval
Pierstoval / phpv.bash
Last active Jul 23, 2019
# Change PHP version rapidly when using Homebrew (MacOSX)
View phpv.bash
#!/bin/bash
# Use:
# $ phpv
# > Will return current global php version, and ALL php versions symlinked
#
# $ phpv {version}
# > Will "brew unlink" all versions, and "brew link php{version}"
# View README file for more info
@jimbojsb
jimbojsb / gist:1630790
Created Jan 18, 2012
Code highlighting for Keynote presentations
View gist:1630790

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

You can’t perform that action at this time.