Skip to content

Instantly share code, notes, and snippets.

View bendangelo's full-sized avatar

Ben D'Angelo bendangelo

View GitHub Profile
@bendangelo
bendangelo / preprocess-twitter.rb
Created July 14, 2024 16:29
Preprocess tweets to gather keywords
# Ruby 2.0
# Reads stdin: ruby -n preprocess-twitter.rb
#
# Script for preprocessing tweets by Romain Paulus
# with small modifications by Jeffrey Pennington
def tokenize input
# Different regex parts for smiley faces
eyes = "[8:=;]"
@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 / 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. #
@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();
*/