Skip to content

Instantly share code, notes, and snippets.

View eman41's full-sized avatar
👨‍💻

Eric P. eman41

👨‍💻
View GitHub Profile
@eman41
eman41 / java-proj.sublime-project
Last active December 16, 2015 08:19
Java Project Settings for SublimeLinter. A helpful command here (from javac) is the -d option that provides the target directory for the compiled class files. Standard classpath note: if you keep sub-folders in your lib directory, they must be specified since the -cp switch isn't recursive.Test classes are always in a separate test src so that i…
{
"folders":
[
{
"path": "/C/workspace/project"
}
],
"settings":
{
"SublimeLinter":
@eman41
eman41 / ListAllWithExtension.java
Last active December 16, 2015 09:49
List all files in a directory with an extension filter. [Java 7]
package org.eman.gist;
import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;
import java.util.Collection;
import java.util.Arrays;
/**
* Print out a list of all files with a particular extension from a directory.
* @author eman41
@eman41
eman41 / PlatformController.cs
Last active December 16, 2015 16:08
A movement controller for platforms from an XNA prototype I've been working on. Platforms using this will move back and forth between two points, stopping at each end for the hold-time specified. This is part of a composition-based API, so you can drop in a controller, a sensor, etc and create platforms of various flavors. An option exists to fo…
using System;
using Microsoft.Xna.Framework;
public class PlatformController : IResetable
{
private Vector2 _startPos = Vector2.Zero;
private Vector2 _stopPos = Vector2.Zero;
private float _speed = 0f;
private bool _beingHeld = false;
@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
@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 / 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(
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 / 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;
@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 / 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: