Skip to content

Instantly share code, notes, and snippets.

View joeybeninghove's full-sized avatar

Joey Beninghove joeybeninghove

View GitHub Profile
@joeybeninghove
joeybeninghove / Configuration.cs
Created August 1, 2025 02:19
Setting Item Group Example
public class Configuration : IConfiguration
{
private readonly Risk riskSettings;
private readonly int sortIndex = -1999;
public IEnumerable<SettingItem> Settings => BuildSettings();
public Configuration()
{
riskSettings = new Risk(++sortIndex);
@joeybeninghove
joeybeninghove / ILRepack.targets
Created February 24, 2025 03:43
Quantower Post-Build Event (with ILRepack)
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<RunILRepack>true</RunILRepack>
</PropertyGroup>
<Target Name="ILRepacker" AfterTargets="Build" Condition="'$(RunILRepack)' == 'true'">
<ItemGroup>
<InputAssemblies Include="$(OutputPath)\<your-assembly>.dll"/>
<InputAssemblies Include="$(OutputPath)\<some-third-party-assembly>.dll"/>
@joeybeninghove
joeybeninghove / Quantower.targets
Created February 24, 2025 03:40
Quantower Post-Build Event
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="CopyToQuantower" AfterTargets="PostBuildEvent">
<Copy SourceFiles="$(OutputPath)$(AssemblyName).dll" DestinationFolder="C:\Quantower\Settings\Scripts\Strategies"/>
</Target>
</Project>
[Subject(typeof(TradeManager))]
class when_price_is_updated
{
static ITradeManager subject;
static Mock<ILevelRepository> level_repository;
static Mock<IBroker> broker;
static Mock<ILevel> level;
static Mock<IStopLoss> stop_loss;
static Mock<IConfiguration> configuration;
static Mock<ITakeProfit> take_profit;
@joeybeninghove
joeybeninghove / ILogger.cs
Last active January 29, 2025 00:53
Logging Abstraction Around Quantower
public interface ILogger
{
void Log(string message, LogLevel level = LogLevel.Info);
}
@joeybeninghove
joeybeninghove / adb.md
Created January 16, 2025 23:56
Wirelessly Deploy Code to Rev Robotics Control Hub

To wirelessly connect to a Rev Robotics Control Hub and compile/deploy code from Android Studio using ADB (Android Debug Bridge), follow these steps:


Prerequisites

  1. Ensure Android Studio is installed and configured on your computer.
  2. Make sure your FTC Robot Controller app is set up on the Control Hub.
  3. Install ADB on your computer (if not already included with Android Studio).

/* Copyright Lydia & M1
Take it, I don't care
Programming is just copying
*/
package org.firstinspires.ftc.teamcode;
import com.qualcomm.robotcore.eventloop.opmode.OpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.hardware.Servo;
@joeybeninghove
joeybeninghove / toggle_controller.js
Created February 5, 2021 17:02
Toggle Controller
import { Controller } from 'stimulus'
export default class extends Controller {
static targets = ['content', 'keyword', 'iconDown', 'iconUp']
toggle () {
if (this.contentTarget.classList.contains('hidden')) {
this.showContent()
this.changeKeyword('Hide')
} else {
@joeybeninghove
joeybeninghove / simple_form.rb
Created December 17, 2020 05:08
simple_form + flatpickr
config.wrappers :flatpickr, class: 'mb-6 relative' do |b|
b.use :html5
b.use :label, class: 'mb-2'
b.wrapper tag: :div, html: {
data: {
controller: 'flatpickr',
wrap: true,
alt_format: 'm/d/Y',
flatpickr_cleave_date_pattern: %w[m d Y]
}
@joeybeninghove
joeybeninghove / toHaveClass.js
Last active December 16, 2020 03:58
toHaveCssClass custom matcher for jest-dom
expect.extend({
toHaveCssClass(received, cssClass) {
const pass = received.querySelector(`.${cssClass}`) !== undefined;
return {
message: () => this.isNot ? `${cssClass} was found` : `${cssClass} not found`,
pass: pass
};
}
});