Skip to content

Instantly share code, notes, and snippets.

View leegould's full-sized avatar
🏠
Working from home

Lee Gould leegould

🏠
Working from home
View GitHub Profile
@leegould
leegould / chomp.cs
Created January 26, 2012 13:56
string extension method - Chomp
using System.Text.RegularExpressions;
namespace Extensions
{
public static class StringExtensions
{
/// <summary>
/// Small function to try and strip a bunch of text down to the first
/// number of words, or just return the original string if it is less
/// than that number of words.
@leegould
leegould / HasRepeatedCharacters.cs
Created January 26, 2012 14:00
string extension method - HasRepeatedCharacters
namespace Extensions
{
public static class StringExtensions
{
/// <summary>
/// Check string for repeated characters
/// </summary>
/// <param name="str">string to check (the object being called on)</param>
/// <returns>
/// <c>true</c> if the string has repeated characters otherwise, <c>false</c>.
@leegould
leegould / RemoveSVNFolders.ps1
Created January 26, 2012 14:02
Script - Powershell - Remove .svn Folders
gci $folder -fil '*.svn' -r -fo | ? {$_.psIsContainer} | ri -fo
@leegould
leegould / RemoveSVNFolders.bat
Created January 26, 2012 14:02
Script - Batch - Remove .svn folders
dir *.svn /b /A:HD /S > svn-files.txt
for /F "eol=;" %i IN (svn-dirs.txt) DO rmdir %i /q /s
@leegould
leegould / PasswordDigestRequest.cs
Created February 17, 2012 12:46
Soap Password Digest
using System;
using System.Configuration;
using System.Security.Cryptography;
using System.Text;
namespace SoapServices
{
///
/// Example class for creating a Password Digest Header in .Net
///
@leegould
leegould / HttpRequestExtensions.cs
Created February 17, 2012 12:50
HttpRequest extension method - GetSiteUrl
using System.Web;
namespace www.Helper
{
public static class HttpRequestExtensions
{
/// <summary>
/// Extension method to retrieve the site url.
/// e.g.
/// http://localhost:1234/ or
@leegould
leegould / jabbrindex.js
Created February 23, 2012 12:44
JabbR Janrain settings
if (typeof window.janrain !== 'object') window.janrain = {};
window.janrain.settings = {};
janrain.settings.appUrl = 'https://yourjanrainurl.rpxnow.com';
janrain.settings.providers = ["google", "facebook", "linkedin", "live_id", "twitter", "yahoo"];
var url = document.location.href;
...
@leegould
leegould / GetNamespaces.cs
Created February 27, 2012 11:23
Get Namespaces
using System;
using System.Linq;
using System.Reflection;
namespace GetNamespaces
{
class Program
{
static void Main(string[] args)
{
@leegould
leegould / CommandLineArgs.cs
Created March 13, 2012 10:24
Command Line Args
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
namespace CommandLineUtils
{
/// <summary>
/// Arguments class.
/// </summary>
/// <seealso cref="http://www.codeproject.com/Articles/3111/C-NET-Command-Line-Arguments-Parser"/>
@leegould
leegould / TimeThis.cs
Created April 26, 2012 15:49
TimeThis
using System;
using System.Diagnostics;
namespace NewsfeedArchiverConsole
{
public class TimeThis : IDisposable
{
private readonly Stopwatch timer;
private readonly Action<string> func;
private readonly string endMessage;