Skip to content

Instantly share code, notes, and snippets.

View bendangelo's full-sized avatar

Ben D'Angelo bendangelo

View GitHub Profile
@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 / telegram_notifier.rb
Created January 3, 2024 17:53
Telegram notifier for exception notifier gem
# inside initializers/exception_notifier.rb
# Webhook notifier sends notifications over HTTP protocol. Requires 'httparty' gem.
# config.add_notifier :telegram, {
# api_key: Rails.application.credentials.telegram_api,
# chat_id: Rails.application.credentials.telegram_chat,
# backtrace_length: 10,
# body: {
# disable_notification: true,
# parse_mode: "HTML"
# }
@bendangelo
bendangelo / chromable.rb
Created December 11, 2023 01:08
Add Chromadb methods to your Rails Models. This is a model concern.
# Add to model:
# include Chromable
# chroma do
# hnsw_space :cosine
# embedding :name
# document :label
# metadata :name
# end
# Usage:
@bendangelo
bendangelo / StatList.cs
Created March 6, 2022 22:04
Set any number of custom values to items, abilities etc for an RPG.
// (c) 2022 Ben D'Angelo. www.throwtheproject.com
// This code is licensed under MIT license (see LICENSE.txt for details)
using System.Collections;
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Assertions;
public class StatList {
@bendangelo
bendangelo / TileNode.cs
Created March 6, 2022 17:08
A tile searching algorithm for tactical-rpgs like games or any tile-based game. Unity C#
// (c) 2022 Ben D'Angelo. www.throwtheproject.com
// This code is licensed under MIT license (see LICENSE.txt for details)
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.Assertions;
using System;
public class TileNode {
public Vector2 pos;
@bendangelo
bendangelo / Node.cs
Created March 5, 2022 21:12
PathFind & PathFindProps classes for finding paths in tile-based games
// (c) 2022 Ben D'Angelo. www.throwtheproject.com
// This code is licensed under MIT license (see LICENSE.txt for details)
using UnityEngine;
using System.Collections;
using System;
public class Node : IComparable<Node> {
public Vector2 pos;
public Node parent;
@bendangelo
bendangelo / haxe-openfl.sh
Created June 6, 2021 17:30 — forked from moret/haxe-openfl.sh
Install Haxe using Brew and set the haxelib path
# Install Haxe using Brew and set the haxelib path
brew install haxe
haxelib setup /usr/local/Cellar/haxe/lib
# Install lime
haxelib install lime
# Install lime tools
haxelib install format
haxelib install svg
@bendangelo
bendangelo / README.md
Created January 8, 2021 11:19 — forked from mandarinx/README.md
Sprite outlines shader
@bendangelo
bendangelo / S3InstallUbuntu
Created May 22, 2012 06:52
One line install S3cmd on Ubuntu
# Install with:
# bash < <(curl -L https://raw.github.com/gist/2767174)
echo "Installing S3cmd..."
wget -O- -q http://s3tools.org/repo/deb-all/stable/s3tools.key | sudo apt-key add -
sudo wget -O/etc/apt/sources.list.d/s3tools.list http://s3tools.org/repo/deb-all/stable/s3tools.list
sudo apt-get update && sudo apt-get install s3cmd
echo "Done"
@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) {