This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static string GuidToShortGuid(Guid gooid) | |
{ | |
string encoded = Convert.ToBase64String(gooid.ToByteArray()); | |
encoded = encoded.Replace("/", "_").Replace("+", "-"); | |
return encoded.Substring(0, 22); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for /f "tokens=* delims=" %%i in ('dir /s /b /a:d *svn') do ( | |
rd /s /q "%%i" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT DB_NAME(database_id) AS DatabaseName, | |
Name AS Logical_Name, | |
Physical_Name, (size*8)/1024 SizeMB | |
FROM sys.master_files | |
ORDER BY SizeMB DESC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Linq; | |
namespace FizzBuzz | |
{ | |
class Program | |
{ | |
static void Main(string[] args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace ShortCodes | |
{ | |
public static class ShortCodes | |
{ | |
// You may change the "shortcode_Keyspace" variable to contain as many or as few characters as you | |
// please. The more characters that are included in the "shortcode_Keyspace" constant, the shorter | |
// the codes you can produce for a given long. | |
private static string shortcodeKeyspace = "abcdefghijklmnopqrstuvwxyz0123456789"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Create a temporary table in an in-memory variable simply to allow the | |
-- select statement to output multiple rows. | |
DECLARE @TestTable TABLE (uniqueID int) | |
INSERT INTO @TestTable | |
SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL | |
SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9 UNION ALL SELECT 10 | |
-- The main Select statement that shows different correct (and incorrect) ways to generate | |
-- "random" things in a set-based select statement. | |
SELECT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Globalization; | |
namespace NumberFunctionUtilities | |
{ | |
public static class NumberFunctions | |
{ | |
public static bool IsNumeric(this object expression) | |
{ | |
if (expression == null) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Security.Cryptography; | |
namespace BetterRandomNumbers | |
{ | |
// BetterRandom.cs | |
// This class implements a random number generator that is based off the Windows "Next Generation" cryptographically secure | |
// random number generator. It inherits from the base Random class, so can be used as a "drop-in" replacement for the | |
// built-in .NET System.Security.Random class, but providing a superior quality of random numbers. | |
public class BetterRandom : Random, IDisposable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq.Expressions; | |
using System.Reflection; | |
namespace Bleroy.Helpers { | |
public static class NotNull { | |
public static TProp Get<TSource, TProp>(this TSource source, Expression<Func<TSource, TProp>> property) where TSource : class { | |
if (source == null) return default(TProp); | |
var current = property.Body; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class BubbleBabble | |
{ | |
private static readonly string vowels = "aeiouy"; | |
private static readonly string consonants = "bcdfghklmnprstvzx"; | |
public static string Convert(byte[] bytes) | |
{ | |
int seed = 1; | |
int rounds = 1 + bytes.Length / 2; | |
StringBuilder result = new StringBuilder(); |
OlderNewer