Skip to content

Instantly share code, notes, and snippets.

View eman41's full-sized avatar
👨‍💻

Eric P. eman41

👨‍💻
View GitHub Profile
@eman41
eman41 / SlackVerificationService.cs
Last active October 22, 2021 15:10
Example verifying a Slack slash command POST request (C#, ASP.NET, Core 3.1)
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// In ASP .NET Core 3.1, there is some required middleware in Startup.cs to enable reading the raw body text more than once
// Startup.cs
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
@eman41
eman41 / LogFileMonitor.cs
Created February 18, 2021 18:21 — forked from mikedavies-dev/gist:989dd86a1ace38a9ac58
A simple log file monitor class for .NET
/*
A simple log file monitor class for .NET
Uses a threaded timer to check for changes in the file, if the file length has changed then the unread
section of the file is read and parsed into lines before being passed back to the event handler.
Note, because the class uses the threaded timer callbacks on the event hander WILL be made form a
different thread, keep this in mind when using the class.
@eman41
eman41 / gist:4fc5ed783d4c1d89c2ddb4476b6348a3
Created February 18, 2021 18:21 — forked from mikedavies-dev/gist:989dd86a1ace38a9ac58
A simple log file monitor class for .NET
/*
A simple log file monitor class for .NET
Uses a threaded timer to check for changes in the file, if the file length has changed then the unread
section of the file is read and parsed into lines before being passed back to the event handler.
Note, because the class uses the threaded timer callbacks on the event hander WILL be made form a
different thread, keep this in mind when using the class.
@eman41
eman41 / GenericDetailsCustomization.h
Last active May 15, 2019 04:59
This is an Unreal Editor header for creating a simple templated details customization to reduce boilerplate.
#pragma once
#include "CoreMinimal.h"
#include "IDetailCustomization.h"
#include "DetailLayoutBuilder.h"
template<typename CustomizedType, typename DetailsClass>
class FGenericDetails : public IDetailCustomization
{
public:
@eman41
eman41 / unreal-editor-programming.md
Last active June 4, 2019 15:22
A one stop list of requirements, notes, and samples for developing extensions to the Unreal Editor

Unreal Editor Styles

Required Modules

  • Slate
  • SlateCore
  • Input Core (Some input fields, i.e. SNumericEntry, have input hooks and require this module)

Optional Modules

@eman41
eman41 / Joystick.cs
Last active June 4, 2017 18:43
Two axis joystick rotation
// Joystick.cs - 06/02/2017
// Eric Policaro
using UnityEngine;
namespace Esp.Entity
{
public class Joystick : MonoBehaviour
{
public Transform Target;
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
/// From:
/// https://bitbucket.org/C3/2d-xna-primitives/wiki/Home
///
public static class Primitives2D
{
@eman41
eman41 / LeftClickContextMenuBehavior.cs
Last active August 29, 2015 14:20
This is an attached behavior that will show the `ContextMenu` for a Button control when left-clicked.
// LeftClickContextMenuBehavior.cs, 4/30/2015 5:49:44 PM
using System;
using System.Windows;
using System.Windows.Controls;
namespace Common.AttachedBehaviors
{
public static class LeftClickContextMenuBehavior
{
private static readonly DependencyProperty LeftClickContextMenuProperty = DependencyProperty.RegisterAttached(
@eman41
eman41 / build.xml
Created May 17, 2013 21:45
Super basic ANT build for a standard java project. Uses a src/test/bin/lib/dist project structure.
<project name="Project" default="dist" basedir=".">
<property name="version" value="0.0"/>
<property name="src" location="src"/>
<property name="build" location="bin"/>
<property name="dist" location="dist"/>
<property name="test" location="test"/>
<property name="lib" location="lib"/>
<path id="project.class.path">
@eman41
eman41 / file_find_replace.rb
Last active December 16, 2015 17:39
A ruby snippet found on SO for doing a find and replace in a text file. Slightly modified for a recent use case.
# Inspired this question/answer (up-vote him!):
# http://stackoverflow.com/a/1274631/1598965
file_names = ['foo.txt', 'bar.txt']
file_names.each do |file_name|
text = File.read(file_name).gsub(/search_regexp/, "replace string")
# This will overwrite the existing file with the above gsub output!
File.open(file_name, "w+") {|file| file.puts text}
end