Skip to content

Instantly share code, notes, and snippets.

@jonezy
jonezy / ServiceBase.cs
Created August 30, 2011 19:03
Base class for subsonic data access files, just inherit this class (rename the db type to match your own), provide the subsonic entity type. Has deps on subsonic and richmondday.helpers
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using CollectBruceLee;
using CollectBruceLee.Data;
using RichmondDay.Helpers;
@jonezy
jonezy / HtmlHelpers.cs
Created May 11, 2011 20:46
Helpers for MVC projects (rob conery would recognize these)
using System.Web.Routing;
using System.Web.Mvc.Html;
namespace System.Web.Mvc {
public static class HtmlHelpers {
static string BaseUrl { get { return HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) + VirtualPathUtility.ToAbsolute("~/"); } }
static string publicDirectory = VirtualPathUtility.ToAbsolute("~/") + "public";
static string scriptDirectory = "javascript";
using System;
using System.Linq;
using System.Web;
using System.Web.UI.WebControls;
using MiniRideAndDrive.Web.Data;
public static partial class Helpers {
public static string BaseUrl {
@jonezy
jonezy / EmailHelper.cs
Created May 11, 2011 20:43
Static email methods that make life eas(ier)
using System;
using System.Collections.Generic;
using System.Net.Mail;
using System.Text.RegularExpressions;
namespace MiniRideAndDrive.Web {
public static class EmailHelper {
public static string EmailValidationExpression {
get {
return @"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}" +
@jonezy
jonezy / .gitignore
Created March 3, 2011 13:46
gitignore file for .net projects
bin
obj
*.suo
*.user
*.*~
@jonezy
jonezy / gist:822706
Created February 11, 2011 17:24
default heading sizes
/* resets the heading sizes */
h1 { font-size: 2em;}
h2 { font-size: 1.5em;}
h3 { font-size: 1.17em;}
h5 { font-size: .83em;}
h6 { font-size: .75em;}
@jonezy
jonezy / updateconnectionstring.sql
Created November 29, 2010 15:12
changes all the connection strings to point to your local sql instance
UPDATE Site SET ConnectionString = REPLACE(ConnectionString, 'SDFMAXVCUS0667', 'NAMEOFYOURLOCALSQLSERVER')
SELECT ci.ProductID, COUNT(ci.ProductID) AS Total
FROM CartItem AS ci INNER JOIN
SportPick AS sp ON sp.SportPickID = ci.ProductID
GROUP BY ci.ProductID, sp.Winner
ORDER BY Total
/*
prepends the client identifier to all occurences of a theme directory call
useful for when moving data from local to production
just update @ClientIdentifier to match the clients theme directory name.
WARNING: YOU HAVE TO MANUALLY SET THE LENGTH IN SUBSTRING(HtmlText, 0, 6) = @ClientIdentifier TO MATCH THE LENGTH OF THE @ClientIdentifier.
If you need to debug, just use this statement
SELECT CAST(REPLACE(CAST(HtmlText as nvarchar(max)), '/admin/theme/','/'+ @ClientIdentifier +'/admin/theme/') as ntext) FROM Html
/*
prepends the client identifier to all occurences of a theme directory call
useful for when moving data from production to local dev
just update @ClientIdentifier to match the clients theme directory name.
WARNING: only run this locally, handwrite something if your going from local to prod
If you need to debug, just use this statement
SELECT CAST(REPLACE(CAST(HtmlText as nvarchar(max)), '/admin/theme/','/'+ @ClientIdentifier +'/admin/theme/') as ntext) FROM Html