Skip to content

Instantly share code, notes, and snippets.

View ferventcoder's full-sized avatar
🎯
Focusing

Rob Reynolds ferventcoder

🎯
Focusing
View GitHub Profile
@ferventcoder
ferventcoder / InstallChocolatey.cmd
Created April 2, 2012 21:38
Chocolatey One Line Install from the command line
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('http://bit.ly/psChocInstall'))";
@ferventcoder
ferventcoder / EnumerationExtensions.cs
Created April 4, 2012 19:04
MVC Html DropDownListHelper
public static class EnumerationExtensions
{
public static IEnumerable<SelectListItem> GetEnumerationItems(this Enum enumeration)
{
var listItems = Enum
.GetValues(enumeration.GetType())
.OfType<Enum>()
.Select(e =>
new SelectListItem()
{
@ferventcoder
ferventcoder / Where.ps1
Created April 4, 2012 21:14
Somebody's where.exe implementation as powershell ;)
$exe = 'git';
if($exe.EndsWith('.exe') -or $exe.EndsWith('.bat')) { $exe = $exe.Substring(0, $exe.Length - 4)}; (ls env:\path).Value.split(';') | %{ if( test-path "$_\$exe.exe" ) { ls "$_\$exe.exe" }; if( test-path "$_\$exe.bat" ) { ls "$_\$exe.bat" }; } | %{ if($_.FullName.EndsWith('.exe') -or $_.FullName.EndsWith('.bat')) { $_.FullName } }
@ferventcoder
ferventcoder / SomeController.cs
Created April 24, 2012 16:51
Clean controllers in ASP.NET MVC
using System.Web.Mvc;
using WebProject.Domain;
using WebProject.Infrastructure.App.Services;
using WebProject.Web.Models;
namespace WebProject.Web.Controllers
{
public class SomeController : BaseController<SomeModel, SomeDomain>
{
@ferventcoder
ferventcoder / ReduceThatDB.sql
Created June 16, 2012 12:48
D to the B to the A - Reducing the size of a SQL Server database
/*
* Scripts to remove data you don't need here
*/
/*
* Now let's clean that DB up!
*/
DECLARE @DBName VarChar(25)
@ferventcoder
ferventcoder / 1_UserRepositoryLinqService.cs
Last active October 6, 2015 13:17
RepositoryPattern with Linq Query Services
namespace SomeProject.Infrastructure.App.Services
{
/// <summary>
/// Houses the queries against users in the database
/// </summary>
public class UserRepositoryService : BaseRepositoryService<User>, IUserRepositoryService
{
private readonly IDateTimeService _dateTimeService;
/// <summary>
@ferventcoder
ferventcoder / Errors.txt
Created June 28, 2012 05:30
Weird error...when upgraded to nuget 2.0
Pushing to custom source
Failed to process request. 'The schema version of 'package' is incompatible w
ith version 1.6.21205.9031 of NuGet. Please upgrade NuGet to the latest version
from http://go.microsoft.com/fwlink/?LinkId=213942.'. The remote server returne
d an error: (500) Internal Server Error..
public class SomeClass {
public void SomeMethod() {
this.Log().Info(() => "Here is a log message with params which can be in Razor Views as well: '{0}'".FormatWith(typeof(SomeClass).Name));
}
}
@ferventcoder
ferventcoder / 1Response.json
Created July 12, 2012 22:47
RestSharp Issue - Response With Different Named Types - How do you set this up?
"votePerOption":[{"Option1Votes":0},{"Option2Votes":1},{"Option3Votes":2},{"Option4Votes":1}]
@ferventcoder
ferventcoder / 1Registration.cs
Created July 17, 2012 22:56
WebBackgrounder - IoC improvements
Bind<IJob>().ToMethod(context => new SyncWithMeetingsJob(context.Kernel, interval: TimeSpan.FromMinutes(Config.GetConfigurationSettings().MeetingsMinutesBetweenUpdates), timeout: TimeSpan.FromMinutes(20))).InSingletonScope();