Skip to content

Instantly share code, notes, and snippets.

View pjmagee's full-sized avatar
🤨

Patrick Magee pjmagee

🤨
View GitHub Profile
// You are doomed if you use anchors.
// Page_IsValid is always true as its validators are never triggered. This only works on a form submit.
// I have come up with a solution that works well using anchors and using the client side asp.net validation functions with web forms:
// Since the anchors can contain many general things, there a few anchors you would want to exclude, including those which open modals or add / remove rows when posting data.
// We know any btn-cancel could potentially close a modal, we ignore these
// we know any void(0) functions are going to open up a modal, or they will add/remove rows, we ignore these
// We know exports of results could be downloaded multiple times, we ignore these
git log --since='1day' --pretty=format:'- %s' > log.txt
Enterprise applications are exactly that. Large. Large applications involve many processes that are unique that may involve the manipulation of the same amount of data from various parts of the application.
A tightly coupled design of an application will cause all areas of the application to have side effects, these side effects call for hacks to fix those single points of the application, but because of this, they have a direct effect on every other part of the application that has a dependency on that part, which is the reason that tightly coupled applications are the exact opposite of how any enterprise application should be written.
They require several things.
1) A service layer which can handle individual working components of the system.
2) These services can take in other services that are required to act as a facade when multiple single services serve as part of a larger process or business process.
3) Interfaces that can provide well defined business processes for all components of the applicatio
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="bin;Framework;" />
<dependentAssembly>
<assemblyIdentity name="Common.Logging" publicKeyToken="af08829b84f0328e" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.1.2.0" newVersion="2.1.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="HtmlAgilityPack" publicKeyToken="bd319b19eaf3b43a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.4.6.0" newVersion="1.4.6.0" />
</dependentAssembly>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="bin;Framework;" />
<dependentAssembly>
<assemblyIdentity name="Common.Logging" publicKeyToken="af08829b84f0328e" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.1.2.0" newVersion="2.1.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="HtmlAgilityPack" publicKeyToken="bd319b19eaf3b43a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.4.6.0" newVersion="1.4.6.0" />
ListButtons.Where(b =>
b.Buttons.LinkTemplate.Contains("fa") &&
!b.Buttons.LinkTemplate.Contains("fa-lg") &&
b.Buttons.StyleButtonStyle.MarkupTag == "asp:LinkButton").Select(b => b.Buttons);
@pjmagee
pjmagee / VLC.linq
Last active August 29, 2015 13:59
LinqPad Script to enumerate all new shows and open vlc full screen with the playlist.
<Query Kind="Statements" />
var files = new DirectoryInfo(@"\\diskstation\video\TV Shows")
.EnumerateFiles("*.*", SearchOption.AllDirectories)
.Where(f => f.Extension == ".mkv" || f.Extension == ".mp4" || f.Extension == ".avi")
.Where(f => f.CreationTime.Date == DateTime.Today)
.Select(f => "\"" + f.FullName + "\"");
var arguments = string.Join(" ", files.Concat(new[] { "--fullscreen" }));
# Restore a Database backup to the given database name
# providing the SQL .bak file to use.
# Author: Patrick Magee
# TODO: Load password from external source.
Import-Module sqlps -Verbose
$databaseName = "SQL_DATABASE_NAME" # Local UAT Database Backup Name
$backupFile = "SQL_BACKUP_FILE.bak" # The file
@pjmagee
pjmagee / gist:9372c2017ac5e57b60ca
Created May 2, 2014 17:11
M# Framework Object.Get Bug.
void Main()
{
default(Container).Dump("default(Container)");
(default(Container?)).Dump("default of (Container?)");
var owner = new Owner() { NullContainer = null };
var nullContainer = owner.Get(o => { o = null; return o.NullContainer; });
typeof(Container?).Dump("typeof Container?");
void Main()
{
var seriesFolders = Directory.GetDirectories(@"\\diskstation\video\TV Shows", "*Season*", SearchOption.AllDirectories);
var shows = seriesFolders.GroupBy(season => season.Split(new[] { " Season " }, StringSplitOptions.RemoveEmptyEntries).First()).AsEnumerable();
var series = shows.Select(grp => grp.Last());
var files = series.SelectMany(directory => new DirectoryInfo(directory).GetFiles()).Where(f => IsMediaExtension(f) && IsInRange(f) && IsWanted(f));
files.Select(f => new Hyperlinq(() => Process.Start(new ProcessStartInfo(@"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe", "\"" + f.FullName + "\"")), f.Name)).Dump("Episodes");
var arguments = string.Join(" ", files.Select(file => "\"" + file.FullName + "\"").Concat(new [] { "--fullscreen" }));
new Hyperlinq(() => Process.Start(new ProcessStartInfo(@"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe", arguments)), "Playlist").Dump();