I hereby claim:
- I am craigtp on github.
- I am craigtp (https://keybase.io/craigtp) on keybase.
- I have a public key whose fingerprint is 8FBD 50F4 7D2C E90F 95D6 1B27 3965 4610 07EB B49F
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
gci -recu -inc "*.*" | % { $_.LastWriteTime = Get-Date } |
public static class NumericHelpers | |
{ | |
// Float point maths is whack. We can't check for absolute equality as floating point numbers are imprecise | |
// and are subject to rounding issues (See: http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html) | |
// Therefore, we can't check for absolute equality, but instead we have to need to check for values being | |
// "nearly" equal, which allows a small margin of error (i.e. something known as the "Epsilon" value for | |
// the given data type for this CPU that this code is running on). | |
public static bool NearlyEqual(double a, double b, double epsilon) | |
{ | |
var absA = Math.Abs(a); |
using System; | |
using System.Text; | |
namespace RandomString | |
{ | |
public class RandomString : IDisposable | |
{ | |
// Can use the BetterRandom class here or just use the built-in System.Random class. | |
private BetterRandom random = new BetterRandom(); | |
private const string alpha_selection = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; |
public static class StringExtentionMethods | |
{ | |
public static string TruncateAtWord(this string input, int maxlength, bool addEllipsis) | |
{ | |
if (input == null || input.Length <= maxlength) return input; | |
var ellipsisLengthDeduction = (addEllipsis ? 3 : 0); | |
var iLastSpace = input.LastIndexOf(" ", (maxlength - ellipsisLengthDeduction), StringComparison.Ordinal); | |
var iLength = 0; | |
if (iLastSpace < 0) | |
{ |
using System; | |
using System.Globalization; | |
namespace NumberFunctionUtilities | |
{ | |
public static class NumberFunctions | |
{ | |
public static bool IsNumeric(this object expression) | |
{ | |
if (expression == null) |
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Linq; | |
namespace FizzBuzz | |
{ | |
class Program | |
{ | |
static void Main(string[] args) |
for /f "tokens=* delims=" %%i in ('dir /s /b /a:d *svn') do ( | |
rd /s /q "%%i" | |
) |
public static string GuidToShortGuid(Guid gooid) | |
{ | |
string encoded = Convert.ToBase64String(gooid.ToByteArray()); | |
encoded = encoded.Replace("/", "_").Replace("+", "-"); | |
return encoded.Substring(0, 22); | |
} |
dir -Directory -Recurse | ? { test-path (join-path $_.FullName ".hg\hgrc") } | % { $_.FullName; Set-Location -Path $_.FullName; iex "hg pull -u" } |