Skip to content

Instantly share code, notes, and snippets.

View dwcullop's full-sized avatar
💭
01010011 01101111 01101101 01100101 01110100 01101000 01101001 01101110 01100111

Darrin W. Cullop dwcullop

💭
01010011 01101111 01101101 01100101 01110100 01101000 01101001 01101110 01100111
View GitHub Profile
@dwcullop
dwcullop / CollectionInterleave.cs
Last active August 29, 2015 14:23
Class that implements extension methods for Interleaving multiple collections into one collection.(e.g. [A, A, A,] + [B, B, B] = [A, B, A, B, A, B])
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
namespace DareWare.Utils.Extensions
{
/// <summary>
@dwcullop
dwcullop / RandomEx.cs
Created June 27, 2015 04:09
Cryptographically Secure Random Number Generator with a bunch of useful functions
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Security.Cryptography;
namespace DareWare.Utils
{
#region Enum Types
@dwcullop
dwcullop / HtmlBuilder.cs
Created July 22, 2015 21:58
Started work on an HTML builder class but can't finish it now... Throwing it here for safe keeping / whatever anyone else wants to do with it. Its basically a thin wrapper around using Linq/XML to generate HTML to make it more readable. What we really need is some sort of short hand code for describing how to display a document. Some sort of way…
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Linq;
namespace DareWare.Utils
@dwcullop
dwcullop / ByteDisplay.cs
Created March 2, 2016 01:20
Helper Class for Displaying Quantities of Bytes in a user friendly way (e.g., "1.11 MB" instead of "1160165 Bytes") and an extension method class to facilitate calling it on various numeric datatypes
using System;
namespace DareWare.Utils
{
/// <summary>
/// Static Helper Class that implements the ShowBytes functionality
/// </summary>
public static class ByteDisplay
{
#region Private Fields
@dwcullop
dwcullop / ascii-binary-converter.js
Last active March 25, 2016 18:33 — forked from eyecatchup/ascii-binary-converter.js
JavaScript native ASCII to Binary / Binary to ASCII convert functions.
// ABC - a generic, native JS (A)scii(B)inary(C)onverter.
// (c) 2013 Stephan Schmitz <eyecatchup@gmail.com>
// License: MIT, http://eyecatchup.mit-license.org
// Original URL: https://gist.github.com/eyecatchup/6742657
//
// Slightly modified by Darrin W. Cullop (dexstar@gmail.com)
// URL: https://gist.github.com/dwcullop/590d84b51a13e0cdda74
var ABC = {
toAscii: function(bin) {
return bin.match(/[01]{8}/g)
@dwcullop
dwcullop / .gitconfig
Last active April 3, 2024 12:27 — forked from pksunkara/config
Sample of git config file (Example .gitconfig)
[user]
name = Darrin W. Cullop
email = v-dacull@microsoft.com
[core]
editor = \"C:\\Program Files\\Microsoft VS Code\\Code.exe\" \"-n\"
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol,space-before-tab
tabwidth=4
excludesfile = ~/.gitignore
symlinks = false
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap.min.css" rel="stylesheet" type="text/css">
<title>JS Bin</title>
</head>
@dwcullop
dwcullop / DataCollectionExtensions.cs
Last active May 20, 2016 20:01
Extension methods to create CSV/TSV content from any collection of POCO objects. Uses reflection to get all the readable properties and their names. Has overloads for optionally wrapping values in quotes, or supplying a value for missing values, etc.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
namespace DareWare.Utils
{
public static class DataCollectionExtensions
{
#region Public Methods
@dwcullop
dwcullop / NumberGen.sql
Last active June 9, 2016 04:40
Generates a table listing values from 0 to 99,999 which can be a really handy table if you know what you're doing.
WITH digits AS
(
SELECT *
FROM
(
VALUES (0), (1), (2), (3), (4),
(5), (6), (7), (8), (9)
) AS nums(n)
)
SELECT lOOOO.OO + lOOO.OO + lOO.OO + lO.OO + l.OO AS N
@dwcullop
dwcullop / fixCamelCase.js
Last active July 2, 2016 00:04
Function for converting camelCase and/or PascalCase strings into a string with normal spacing and a function to test it. If you find a case where it doesn't work, please add it to the comments.
function fixCamelCase( str )
{
return str.replace( /(?!^)(\S)?([A-Z][a-z])/, ( m, a, b ) => a ? a + " " + b : m )
.replace( /(?:^|\s)[a-z]/g, m => m.toUpperCase() )
.replace( /(?:[a-z][A-Z]|\D\d)/g, m => m[0] + " " + m[1] );
}
(function()
{
var tests =