Skip to content

Instantly share code, notes, and snippets.

VisualMelon

Block or report user

Report or block VisualMelon

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:171df96392c9525c7806d56bc80066bd
// this would be a shape/concept/whatever, not an interfae
interface ICommutativeOrdinalThing<T>
{
/// <summary>
/// Commutative addition of things
/// </summary>
T Add(T a, T b); // with proposal, might pick up +
/// <summary>
/// Comparision of the strictly orderable things
View GetBrightestRectangle
public static Rectangle GetBrightestRectangle(this Bitmap bitmap, int width, int height)
{
// Each rectangle's value is its average pixel color.
var rectangles = new Dictionary<Rectangle, float>();
// Iterate through all possible rectangle points.
for (var x = 0; x < bitmap.Width - width; x++)
for (var y = 0; y < bitmap.Height - height; y++)
{
var brightnesses = new List<float>();
View NetTest
using System;
using System.Text;
using System.Threading.Tasks;
using System.Net.Sockets;
namespace NetTest
{
    class Program
    {
        static void Main(string[] args)
View Winforms
var model = new PlotModel { Title = "PNG Rendering" };
model.Axes.Add(new LinearAxis { Position = AxisPosition.Left });
model.Axes.Add(new LinearAxis { Position = AxisPosition.Bottom });
model.Series.Add(new FunctionSeries(x => x * x, 0, 1, 1000));
// export as PNG
var pngExporter = new OxyPlot.WindowsForms.PngExporter();
using (var fs = System.IO.File.Open("test.png", System.IO.FileMode.Create))
@VisualMelon
VisualMelon / testing.cs
Last active Sep 20, 2017
SVG Text Rendering Testing
View testing.cs
var model = new PlotModel { Title = "SVG Text Rendering" };
model.Axes.Add(new LinearAxis { Position = AxisPosition.Left });
model.Axes.Add(new LinearAxis { Position = AxisPosition.Bottom });
model.Annotations.Add(new OxyPlot.Annotations.TextAnnotation()
{
    Text = "A",
    TextPosition = new DataPoint(1080),
    TextVerticalAlignment = VerticalAlignment.Bottom,
});
View chrischeck11.txt
Required Effort: 108
Probability of Success: 0.37527553125
Step Right
Step Right
Step Right
Step Right
Drop
Drop
Step Right
Step Right
@VisualMelon
VisualMelon / chrisstrap.ps1
Last active May 7, 2017
Chris: Office Escape Testing
View chrisstrap.ps1
# Can used with test.ps1
# > . .\test.ps1 chrisstrap.ps1
# Expects perl (5) to be installed, and chris.pl to be in the current directory
#
# You can investigate issues by first writing the solution to a file...
# > type .\testcase0.txt | . .\chrisstrap.ps1 > chrissol0.txt
# ... and then feeding it to OfficeEscapeSolver.exe
# > type .\testcase0.txt | . .\OfficeEscapeSolver.exe * .\chrissol0.txt
# Which will (hopefully) provide helpful information
@VisualMelon
VisualMelon / OfficeEscapeSolver.cs
Last active May 7, 2017
OfficeEscapeSolver, Action file, Test Cases, and PowerShell Test Script
View OfficeEscapeSolver.cs
using System;
using System.Collections.Generic;
using System.Linq;
namespace OfficeEscapeSolver
{
public struct Vector
{
public static Vector Zero = new Vector(0, 0);
View testcase0solution.txt
Required Effort: 139
Step Right
Step Right
Kick Right
Crouch
Shuffle Right
Shuffle Right
Stand
Step Right
Clamber Up Right
View testcase11solution.txt
Required Effort: 108
Probability of Success: 0.37527553125
Step Right
Step Right
Step Right
Step Right
Drop
Drop
Step Right
Step Right
You can’t perform that action at this time.