Skip to content

Instantly share code, notes, and snippets.

View jcolebrand's full-sized avatar

J. Cole Brand jcolebrand

View GitHub Profile
namespace Tooling.WebApi.Common.Utility
using System;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
>>>>>> OS Version
SystemDirectory : C:\Windows\system32
Organization :
BuildNumber : 14393
RegisteredUser : Windows User
SerialNumber : 00376-30818-63755-AA823
Version : 10.0.14393
jcolebrand / httpcontextwrapper.cs
Created February 24, 2017 15:31
for talking to Nick Craver
// this is mockable in your unit tests so you can just assign the func over it
public static Func<HttpContextBase> Context = () => new HttpContextWrapper(HttpContext.Current);
public void SomeMethod(){
var context = Context();
if (context == null) return;
// use context here like you would HttpContext.Current

Keybase proof

I hereby claim:

  • I am jcolebrand on github.
  • I am jcolebrand ( on keybase.
  • I have a public key whose fingerprint is D791 F373 603E EBB4 13FA AF32 7800 2A82 A1EC E4C1

To claim this, I am signing this object:

/* for every x, xBy field pair (eg: deleted/deletedBy), should consider replacing with an object and use falsey-nulls for non-case
* have the object be a "by" which consists of the date and whatever is in the by field, currently a user-id and user-name
chat comments:
id: long,
room: int,
jcolebrand / Log4js.js
Last active December 10, 2015 20:08
log4js implementation as taken on this date. Just for purposes of seeing it in the cloud.
var Log4js = {
version : "1.0",
applicationStartDate : new Date(),
loggers : {},
getLogger : function (categoryName) {
if (!(typeof categoryName == "string")) {
categoryName = "[default]";
if (!Log4js.loggers[categoryName]) {
Log4js.loggers[categoryName] = new Log4js.Logger(categoryName);
jcolebrand / Results.txt
Created June 19, 2012 20:02
StackOverflow 2012 Election Results
OpenSTV version 1.7 (
Suggested donation for using OpenSTV for an election is $50. Please go to to donate via PayPal, Google Checkout, or
Amazon Payments.
Certified election reports are also available. Please go to for more information.
Loading ballots from file stackoverflow-com-2012-election-results.blt.
jcolebrand / gist:2937422
Created June 15, 2012 16:27
tinymce diffs
<span id="anonymous_element_1_container" class="mceEditor defaultSimpleSkin">
<table cellspacing="0" cellpadding="0" class="mceLayout" style="width: 100%; height: 9000px;">
<div class="mceIframeContainer">
<iframe frameborder="0" id="anonymous_element_1_ifr" src="javascript:&quot;&quot;" allowtransparency="true" title="Rich Text Area" style="width: 100%; height: 8980px; display: block;"/>
jcolebrand / Zalgo.html
Created June 15, 2012 00:38
For the perusal of Ben Brocka
<p>You can't parse [X]HTML with regex. Because HTML can't be parsed by regex. Regex is not a tool that can be used to correctly parse HTML. As I have answered in HTML-and-regex questions here so many times before, the use of regex will not allow you to consume HTML. Regular expressions are a tool that is insufficiently sophisticated to understand the constructs employed by HTML. HTML is not a regular language and hence cannot be parsed by regular expressions. Regex queries are not equipped to break down HTML into its meaningful parts. so many times but it is not getting to me. Even enhanced irregular regular expressions as used by Perl are not up to the task of parsing HTML. You will never make me crack. HTML is a language of sufficient complexity that it cannot be parsed by regular expressions. Even Jon Skeet cannot parse HTML using regular expressions. Every time you attempt to parse HTML with regular expressions, the unholy child weeps the blood of virgins, and Russian hackers pwn your webapp. Parsing HTML
Dim WFSDSTRING As New System.Data.SqlClient.SqlConnection
WFSDSTRING.ConnectionString ="Data Source=LED-SQL;Initial Catalog=WorkforceSD_DEV;Integrated Security=True"
Dim Institution As String ="Provider = Microsoft.ACE.OLEDB.12.0;Data Source=C:\Documents and Settings\CSchexnaydre\Desktop\TEST SHEETS\Institution\INST_TEST2010.csv;HDR=YES;"