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 / FileSystemObservable.cs
Created January 3, 2024 01:18
Represent the file system as an Observable ChangeSet
using System.Reactive.Disposables;
using System.Reactive.Linq;
using DynamicData;
namespace DareWare.Utils;
public static class FileSystemObservable
{
public static IObservable<IChangeSet<FileSystemInfo, string>> Create(string path, string filter, bool includeSubDirectories, bool includeError = true) =>
Observable.Create<IChangeSet<FileSystemInfo, string>>(observer =>
@dwcullop
dwcullop / FormatString.h
Created August 2, 2021 23:00
Easy, Old School Printf-Style Formatting for std::string and std::wstring
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// FormatString.h : Standard String Formatting Support
//
// Author Name :
// Darrin W. Cullop ([email protected])
//
// License :
// CC-BY 4.0 (https://creativecommons.org/licenses/by/4.0/)
//
// Abstract :
@dwcullop
dwcullop / DebuggingHelpers.h
Last active August 2, 2021 21:05
Debug Logging on Windows in Modern C++
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// DebuggingHelpers.h : Debug Logging on Windows in Modern C++
//
// Author Name :
// Darrin W. Cullop ([email protected])
//
// License :
// CC-BY 4.0 (https://creativecommons.org/licenses/by/4.0/)
//
// Abstract :
@dwcullop
dwcullop / SwgohHelpApi.Program.cs
Last active July 27, 2018 20:38
Helper Classes for using the Star Wars Galaxy of Heroes API provided by www.swgoh.help and a simple example of how to use it. The API requires a login but you can get one by joining their discord server: https://discord.gg/6SbH8kE The helper classes and AllyCode classes are files copied verbatim from another project (that's why the odd namespace…
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace SwgohHelpApi
{
@dwcullop
dwcullop / HiResTimer.cs
Last active May 15, 2019 23:05
Simple High Resolution Timer for C# - Uses Win32 APIs to give you microsecond accuracy timer (dependent on CPU frequency)
using System;
using System.Runtime.InteropServices;
namespace DareWare.Utils
{
/// <summary>
/// High Resolution Timer Class. Uses the Win32 API to create a timer
/// that is as accurate as the system clock, down to microseconds
/// </summary>
public class HiResTimer : IComparable<HiResTimer>, IEquatable<HiResTimer>
@dwcullop
dwcullop / index.html
Created August 7, 2016 23:39 — forked from anonymous/index.html
R41nb0wz!
<div class="container">
<div class="well container-fluid">
<div class="row">
<div class="col-xs-12 col-sm-6">
<div class="h1 rbBase rainbowShadows">Hello, World!</div>
<div class="h3 rbBase rbStacked">Hello, World!</div>
<div class="h2 rbBase rbFuzz">Hello, World!</div>
<div class="h1 rbBase rbFuzz2 rbTextDark">Hello, World!</div>
</div>
<div class="col-xs-12 col-sm-6">
@dwcullop
dwcullop / CreateCSS.js
Last active August 7, 2016 23:15
CSS Keyframes for animating using perfect rainbows by cycling through all of the colors on the color wheel in 12 steps of 30 degrees each. It has 3 sets of colors (normal, darker, and lighter) and shows how to animate text color and shadow. See it in action here: http://codepen.io/dwcullop/full/XKPvZQ/
// Quick and Dirty file for generating Rainbowized CSS scripts
// This could be done with a CSS pre-parser like SCSS or LESS or whatever, but
// for now, it is what it is.
function units(n, units) {
n = parseInt(n);
return n ? n.toString() + units : 0;
}
function unitsF(n, units, digits) {
@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 =
@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 / 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