Skip to content

Instantly share code, notes, and snippets.

View GeorgeHahn's full-sized avatar
🚴‍♂️
🦀🦀🦀

George Hahn GeorgeHahn

🚴‍♂️
🦀🦀🦀
  • Colorado, USA. U+1F3D4
View GitHub Profile
@GeorgeHahn
GeorgeHahn / latebound.cs
Created April 12, 2013 06:25
The goal is to be able to iterate over an array of Shape and have different render methods called depending on the type of the current Shape. Additionally, I would like to retain the ability to add different Render classes in the future.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace UpconvertSharp
{
class Program
{
@GeorgeHahn
GeorgeHahn / RouteyThingey.cpp
Last active December 16, 2015 11:59
Fun with C++11
#include <string>
#include <functional>
#include <stdio.h>
using namespace std;
// Need to create one class each to pass in and out
typedef int (*fp)(int);
class RouteyThingy
{
@GeorgeHahn
GeorgeHahn / Anotar\NLogFody\LogForwardingProcessor.cs
Last active December 17, 2015 20:19
Adding dynamic support
using System;
using System.Collections.Generic;
using System.Linq;
using Mono.Cecil;
using Mono.Cecil.Rocks;
using Mono.Cecil.Cil;
public class LogForwardingProcessor
{
public MethodDefinition Method;
@GeorgeHahn
GeorgeHahn / 1288.user.js
Last active August 29, 2015 13:56 — forked from clsr/1288.user.js
// ==UserScript==
// @name xkcd 1288 substitutions
// @namespace http://github.com/mcef
// @description Substitutions that make reading the news more fun
//
// @include *
// @exclude *github.com/*
// ==/UserScript==
(function() {
@GeorgeHahn
GeorgeHahn / SignalCapture.cs
Created April 1, 2014 07:18
Capture timing data for a signal on one pin of a Netduino
using System.Threading;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware.Netduino;
namespace Analyzer
{
public class Program
{
public static void Main()
{
/* GitHub stylesheet for MarkdownPad (http://markdownpad.com) */
/* Author: Nicolas Hery - http://nicolashery.com */
/* Version: b13fe65ca28d2e568c6ed5d7f06581183df8f2ff */
/* Source: https://github.com/nicolahery/markdownpad-github */
/* RESET
=============================================================================*/
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {
margin: 0;
@GeorgeHahn
GeorgeHahn / gist:914f2ebafff1ccd485b4
Last active September 12, 2018 19:34
Considering Rust + CLR interop

#Brainstorming Rust + C# interop

Use case A

  • Rust UI via WPF or Persperex
  • Make it feel like XAML is Rust-native
  • Put function name in WPF event handler, we stub out from that to Rust code
  • Rust event handlers written with a macro that we use to write interop stubs on each side
  • Can I do GUI nesting without XAML? Eg like the Zinc.rs config block, but for UI elements
  • Pros:
@GeorgeHahn
GeorgeHahn / importer.cs
Last active August 29, 2015 14:18
HAM Radio Test Question Anki Importer
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Pipes;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace FCC2Anki
@GeorgeHahn
GeorgeHahn / ripslides.js
Created May 14, 2015 08:00
Download Slideshare slide sets for which saving has been disabled
// Browser must be ignoring CORS
// Chrome: Disable web security
// Firefox: Requires proxy or Cors Everywhere extension (https://github.com/spenibus/cors-everywhere-firefox-addon)
function loadScript(url, callback)
{
// Adding the script tag to the head as suggested before
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.type = 'text/javascript';
<script src="jszip.min.js"></script>
<script src="FileSaver.min.js"></script>
<script src="https://raw.githubusercontent.com/Stuk/jszip/master/dist/jszip.min.js"></script>
<script src="https://raw.githubusercontent.com/eligrey/FileSaver.js/master/FileSaver.min.js"></script>
(function (main, modules) {
'use strict';
var zip = new JSZip();
for (var property in modules) {