Skip to content

Instantly share code, notes, and snippets.

View BGR360's full-sized avatar
💭
bummin

Ben Reeves BGR360

💭
bummin
  • Qumulo
  • Greater Chicago Area
View GitHub Profile
@BGR360
BGR360 / analyze_repo_languages.py
Created January 20, 2016 00:14
Analyzes a GitHub user's repositories to find their favorite programming languages.
"""
GitHub User Repository Language Analyzer
Created By: Ben Reeves
Date: January 8, 2015
Description:
This script uses the PyGithub library to access the Github API in order to perform some data analysis on a user's
repositories. Specifically, it will analyze all of the user's code and calculate the percentage of code written in
different programming languages.
"""
@BGR360
BGR360 / MeshRenderer.cpp
Created January 20, 2016 00:20
Excerpt from MeshRenderer.cpp from my 3D C++ game engine
//THIS is where aaalll the magic happens.
void MeshRenderer::render()
{
ShaderProgram* shader = m_material->getShader();
//Update the "modelMatrix" uniform
string modelMatrixStr("modelMatrix");
if (!shader->hasUniform(modelMatrixStr))
{
//throw BengineException("The compiled shader is missing uniform 'modelMatrix'.");
@BGR360
BGR360 / ArmController.cs
Created January 22, 2016 17:48
Excerpt from LuigiSimulator
using UnityEngine;
using System.Collections;
public class ArmController : MonoBehaviour
{
public float armSpeed = 10f; //degrees per second
public float leftLimit = 310f;
public float rightLimit = 50f;
public float arm;
@BGR360
BGR360 / CameraController.cs
Created January 22, 2016 17:49
Excerpt from LuigiSimulator
using UnityEngine;
using System.Collections;
public class CameraController : MonoBehaviour
{
private TargetChaser chaser;
private Vector3 initialPosition;
private Quaternion initialRotation;
XboxInput xInput;
@BGR360
BGR360 / LuigiController.cs
Created January 22, 2016 17:52
Excerpt from LuigiSimulator
using UnityEngine;
using System.Collections;
[System.Serializable]
public class Drive
{
public MecanumWheel frontRight;
public MecanumWheel frontLeft;
public MecanumWheel backRight;
public MecanumWheel backLeft;
@BGR360
BGR360 / card_solver.py
Created January 22, 2016 17:54
Excerpt from TwentyFourSolver
def solve(numbers, value):
"""
Uses arithmetic (*, +, -, /) to arrive at value, using my custom recursive algorithm
:param numbers: The list of numbers we're going to use to arrive at value
:param value: The value that we want to arrive at using all of the
:return: If solvable, returns a Solution instance. If not, returns False.
"""
# Referring to the global variables we want to modify
global num_attempts
global current_attempt
@BGR360
BGR360 / MyLocationFinder.java
Created January 22, 2016 17:56
Excerpt from DeliveryDispatcher
/**
* Begins the search to find the device's location. When it finishes or times out,
* it will invoke onLocationFound(Location) on all OnLocationFoundListeners
* in mLocationFoundListeners. If a listener cancels its request for a Location,
* but there are still others waiting, the search will continue.
*
* @param timeoutMillis The amount of time, in milliseconds,
* that we should search for a location
* @return True if we were able to include listener in a new or existing search, or false
* if we were unable to begin searching or if listener was already listening
@BGR360
BGR360 / GameObjectTests.cpp
Created January 22, 2016 18:47
Excerpt from GameEngineTests
#include <Testing.h>
#include <cstdlib>
#include <ctime>
#include <string>
#include <sstream>
#include <vector>
#include <core/GameObject.h>
#include <math/RandomGenerator.h>
@BGR360
BGR360 / Vector3.h
Created January 22, 2016 19:10
Excerpt from the Bengine GameEngine source
#ifndef BENGINE_VECTOR3_H
#define BENGINE_VECTOR3_H
#include <Engine.h>
#include <math/Vector2.h>
using Math::Vector2;
namespace Math
@BGR360
BGR360 / Matrix2x2.inl
Created January 22, 2016 19:11
Excerpt from the Bengine GameEngine source
Matrix2x2 Matrix2x2::adjugate(const Matrix2x2& matrix)
{
return Matrix2x2(
matrix.c1r1 , -1 * matrix.c1r0,
-1 * matrix.c0r1 , matrix.c0r0);
}
float Matrix2x2::determinant(const Matrix2x2& matrix)
{
return matrix.c0r0 * matrix.c1r1 - matrix.c1r0 * matrix.c0r1;