Skip to content

Instantly share code, notes, and snippets.

View brainwipe's full-sized avatar

Rob Lang brainwipe

View GitHub Profile
@brainwipe
brainwipe / Client.cs
Last active January 3, 2016 13:49
For S-O question: This method returns 204.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net.Http;
using System.Net.Http.Headers;
namespace Client
{
@brainwipe
brainwipe / gist:d72eb8cfe570eb002945
Created November 19, 2014 21:19
Heapsort implemented in javascript
<!DOCTYPE html><html><body>
An implementation of Heap sort in javascript using an array as an underlying structure.<br/>
Implemented to teach myself about heap sort and how it works, rather than a super fast implementation. Inspired by
<a href="http://www.algorist.com/">The Algorithm Design Manual</a>.
Use the browser console (F12) to see the output.
<script>
var test_american_history_dates = [1492, 1783, 1776, 1804, 1865, 1945, 1963, 1918, 2001, 1941];
@brainwipe
brainwipe / findloadedtypes.cs
Created February 22, 2016 13:35
Find all loaded types in ASP.NET Core, C# snippet
// Prior to ASP.NET Core, you had access to the AppDomain and all the loaded assemblies.
using Microsoft.AspNet.Mvc.Infrastructure;
using Microsoft.Extensions.PlatformAbstractions;
// Snip...
var assemblyProvider = new DefaultAssemblyProvider(PlatformServices.Default.LibraryManager);
var resourceControllers = assemblyProvider.CandidateAssemblies
@brainwipe
brainwipe / README.md
Created June 10, 2016 23:05 — forked from oodavid/README.md
Deploy your site with git

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
@brainwipe
brainwipe / Explore a Uri
Last active June 21, 2017 09:47
A .NET 4.6.2 one page console app for exploring the parts of a Uri class
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace UriExplorer
{
class Program
{
@brainwipe
brainwipe / gwt.snippet
Last active June 29, 2018 08:38
Unit Test code snippet for Visual Studio 2017 using Given, When, Then and Arrange, Act and Assert
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Keywords>
<Keyword>unit</Keyword>
<Keyword>test</Keyword>
<Keyword>given</Keyword>
<Keyword>when</Keyword>
<Keyword>then</Keyword>
@brainwipe
brainwipe / BloggerToMarkdown.cs
Created October 17, 2018 22:04
Converts Blogger export XML and converts to Markdown
// Requires nuget Package https://www.nuget.org/packages/Html2Markdown/
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Xml;
using Html2Markdown;
@brainwipe
brainwipe / Fourpersontoken.md
Created November 6, 2019 21:47
The four person token

Rob Byrn Aggro Jen

@brainwipe
brainwipe / EventAggregator.cs
Created May 16, 2020 06:17
A fail-fast lightweight event Event Aggregator for Pub/Sub
using System;
using System.Collections;
using System.Collections.Generic;
// From https://www.youtube.com/channel/UCHg8bDmXIYKAwvyc4yMGuUw
namespace Lang.Utility
{
public interface IEvent {}
public class EventAggregator
@brainwipe
brainwipe / Coordinate.cs
Created January 2, 2021 11:17
Struct for Managing Coordinates
/* By Rob Lang
MIT License
https://www.youtube.com/roblang
@brainwipe */
/*
Example Use:
Dictionary<Coordinate, GameObject> grid = new Dictionary<Coordinate, GameObject>();
grid[(0,1)] = new GameObject();
grid[new Coordinate(1,1)] = new GameObject();