Skip to content

Instantly share code, notes, and snippets.

View bendangelo's full-sized avatar

Bendangelo bendangelo

View GitHub Profile
@bendangelo
bendangelo / Gimp 2.8
Created November 17, 2012 16:00
Install Gimp 2.8
sudo add-apt-repository ppa:otto-kesselgulasch/gimp
sudo apt-get update
sudo apt-get install gimp
@bendangelo
bendangelo / Class Inheritance
Created April 10, 2013 13:13
Better class inheritance
// Inspired by base2 and Prototype
(function(){
var initializing = false, fnTest = /xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/;
// The base Class implementation (does nothing)
this.Class = function(){};
// Create a new Class that inherits from this class
Class.extend = function(prop, statics) {
var _super = this.prototype;
@bendangelo
bendangelo / debug
Created November 3, 2013 22:48
Log and assert wrappers.
function LOG() {
if (window.DEBUG_MODE) try {
console.log.apply(console, arguments);
} catch (e) {}
}
function ASSERT(condition, message) {
if (!condition) {
if(console && typeof console.assert == "function"){
console.assert(condition, message);
@bendangelo
bendangelo / EventManager.cs
Last active October 7, 2025 17:55
Unity3D C# Event Manager
/*
* Copyright 2017 Ben D'Angelo
*
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this
* software and associated documentation files (the "Software"), to deal in the Software
* without restriction, including without limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
* to whom the Software is furnished to do so, subject to the following conditions:
@bendangelo
bendangelo / Node.cs
Last active August 29, 2015 14:13
Unity3D Pathfinding Class
using UnityEngine;
using System.Collections;
using System;
public class Node : IComparable<Node> {
public enum OPEN_STATE {
BY_NONE,
BY_START,
BY_END
@bendangelo
bendangelo / GulpFile.js
Last active November 15, 2015 00:15
Karma Gulp Task. Karma version 1.3
/**
* Run test once and exit
*/
gulp.task('test', function (done) {
var karmaServer = new karma.Server({
configFile: __dirname + '/test/karma.conf.js',
singleRun: true
}, function (exitCode) {
done();
process.exit(exitCode);
@bendangelo
bendangelo / video_tag.rb
Created December 13, 2015 05:53
Jekyll Video Tag
# Title: Simple Video tag for Jekyll
# Author: Brandon Mathis http://brandonmathis.com
# Description: Easily output MPEG4 HTML5 video with a flash backup.
#
# Syntax {% video url/to/video [width height] [url/to/poster] %}
#
# Example:
# {% video http://site.com/video.mp4 720 480 http://site.com/poster-frame.jpg %}
#
# Output:
@bendangelo
bendangelo / StatRange.cs
Created September 8, 2016 03:59
Unity3D class used for health bars and anything else that has a min / max.
using UnityEngine;
using System.Collections;
public class StatRange {
public int min { get; set; }
public int max { get; set; }
public int value { get; set; }
public StatRange(int min = 0, int max = 0) {
@bendangelo
bendangelo / AutoSubstitiute.cs
Last active May 8, 2017 18:06
Auto substitute helper method for Zenject.
using UnityEngine;
using System.Collections;
using Zenject;
using NSubstitute;
/*
Usage:
Container.Bind<IPath>().FromSub<IPath>();
Container.Bind<IPath>().FromSub();
*/
@bendangelo
bendangelo / UnityBuildAll.sh
Created November 29, 2017 16:05
OSX script to build unity games.
HELP="
#################################################
# #
# UnityBuildAll #
# #
#################################################
# A simple script by SnowHydra #
# #
# Automated building of your Unity app #
# To Windows, Mac, Linux. #