Skip to content

Instantly share code, notes, and snippets.

View blewert's full-sized avatar
:electron:
back to electron!

Benjamin Williams blewert

:electron:
back to electron!
View GitHub Profile
C:\ProgramData\watcom-1.3\binnt;C:\ProgramData\watcom-1.3\binw;C:\Intel\OpenCL\sdk\bin\x64;C:\Intel\OpenCL\sdk\bin\x86;C:\Intel\OpenCL\sdk\bin\Pin;C:\Intel\OpenCL\sdk\bin\GTPin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\libnvvp;C:\Program Files\Haskell\bin;C:\Program Files\Haskell Platform\8.0.2-a\lib\extralibs\bin;C:\Program Files\Haskell Platform\8.0.2-a\bin;C:\Program Files (x86)\Conan\conan;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\PuTTY\;C:\Program Files (x86)\apitrace\x64\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Users\user\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Microso
comments = [ "hello", "ben my name", "is my ben" ];
results = {};
for comment in comments:
#Run through each comment. Split into tokens
tokens = comment.split();
for token in tokens:
@blewert
blewert / ConvexHull.cs
Last active December 17, 2022 15:56
A Unity C# implementation of the Gift Wrapping algorithm
/**
* @file ConvexHull.cs
* @author Benjamin Williams <[email protected]>
*/
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Linq;
@blewert
blewert / map.cpp
Last active June 28, 2019 17:22
key mapping for arcade machines
//Player 1
WORD* joypad1 = new WORD[8];
//--
joypad1[0] = (WORD)'Q'; // Button 0, Exit
joypad1[1] = VK_RETURN; // Button 1, Start
joypad1[2] = (WORD)'Z'; // Button 2, A
joypad1[3] = (WORD)'X'; // Button 3, B
joypad1[4] = (WORD)'C'; // Button 4, C
joypad1[5] = (WORD)'V'; // Button 5, D
@blewert
blewert / grass.shader
Created April 17, 2018 15:11
Fixed version of grass shader to support Unity standard lighting
Shader "Custom/Grass"
{
Properties
{
//Grass inputs
_RampTex("Ramp", 2D) = "white" {}
_Color("Color", Color) = (1, 1, 1, 1)
_WaveSpeed("Wave Speed", float) = 1.0
_WaveAmp("Wave Amp", float) = 1.0
_HeightFactor("Height Factor", float) = 1.0
@blewert
blewert / Camera.cpp
Created March 23, 2018 09:17
An orbital camera for PhysX
void Camera::UpdateCamera(float mouseX, float mouseY)
{
//Here we're just converting from spherical to cartesian coordinates. There's a good article on
//wikipedia about this transformation:
//https://en.wikipedia.org/wiki/Spherical_coordinate_system#Cartesian_coordinates
//...
//Ideally these should be in the header file for this class, but hey ho
float mouseSensitivity = 1.0f;
seed(5);
random(1);
background(0, 0, 0);
//Tweak these values below to change the spiral
//..
//a is the global scale factor
var a = 90;
https://drive.google.com/file/d/1QV6rmJjKZDXyHGyKo4sLJTh891AoMK-G/view?usp=drive_web
@blewert
blewert / map
Created February 26, 2018 13:47
p1
exit q
start enter
a z
b x
c c
d v
e b
f n
@blewert
blewert / cheatDetector.js
Last active February 25, 2018 04:18
A simple class which can detect cheat combinations by looking at key press events with javascript.
/**
* Class for detecting cheats from keyboard input
*/
var CheatDetector = function()
{
window.addEventListener("keydown", this.onKeyDown.bind(this));
this.cheats = [];
this.map = [];
};