Skip to content

Instantly share code, notes, and snippets.

View bendangelo's full-sized avatar

Ben D'Angelo bendangelo

View GitHub Profile
@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 / 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 / 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 / EventManager.cs
Last active April 26, 2024 20:15
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 / 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 / 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 / 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 / xclip
Created November 12, 2012 19:40
XClip Shortcut
# A shortcut function that simplifies usage of xclip.
# - Accepts input from either stdin (pipe), or params.
# ------------------------------------------------
cb() {
local _scs_col="\e[0;32m"; local _wrn_col='\e[1;31m'; local _trn_col='\e[0;33m'
# Check that xclip is installed.
if ! type xclip > /dev/null 2>&1; then
echo -e "$_wrn_col""You must have the 'xclip' program installed.\e[0m"
# Check user is not root (root doesn't have access to user xorg server)
elif [[ "$USER" == "root" ]]; then
@bendangelo
bendangelo / Download Youtube
Created October 9, 2012 01:12
Download Youtube Video
sudo apt-get install youtube-dl
@bendangelo
bendangelo / Ubuntu Everpad
Created September 17, 2012 16:52
Install Everpad on Ubuntu
# curl -L gist.github.com/raw/3738442 | bash
sudo add-apt-repository ppa:nvbn-rm/ppa
sudo apt-get update && sudo apt-get install everpad -y