This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Open Automator | |
- File -> New -> Service | |
- Change "Service Receives" to "files or folders" in "Finder" | |
- Add a "Run Shell Script" action | |
- Change "Pass input" to "as arguments" | |
- Paste the following in the shell script box: open -n -b "com.microsoft.VSCode" --args "$*" | |
- Save it as something like "Open in Visual Studio Code" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void Save() | |
{ | |
try | |
{ | |
context.SaveChanges(); | |
} | |
catch(DbEntityValidationException ex) | |
{ | |
var errorMessages = (from eve in ex.EntityValidationErrors | |
let entity = eve.Entry.Entity.GetType().Name |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/> | |
<PropertyGroup> | |
<DeployFiles>$(MSBuildStartupDirectory)\DeployFiles.msbuild</DeployFiles> | |
<VersionMajor>1</VersionMajor> | |
<VersionMinor>0</VersionMinor> | |
<VersionPatch>0</VersionPatch> | |
<ChangesetNumber>0</ChangesetNumber> | |
<NugetFileShare>\\itsmanv01\Releases</NugetFileShare> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class ListDiff | |
{ | |
public static List<ListDiffItem<T>> GetDiff<T>(List<T> oldList, List<T> newList, Func<T, T, bool> equalsFunction = null) | |
{ | |
var combined = new List<ListDiffItem<T>>(); | |
foreach(var i in newList) | |
{ | |
var diff = new ListDiffItem<T>(); | |
diff.Item = i; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static DownloadableFile ToDownloadableXmlFileForExcel2003(this System.Xml.Linq.XDocument file, string fileName) | |
{ | |
MemoryStream ms = new MemoryStream(); | |
XmlWriterSettings xmlWriterSettings = new XmlWriterSettings() { Encoding = Encoding.UTF8 }; | |
XmlWriter xmlWriter = XmlWriter.Create(ms, xmlWriterSettings); | |
file.Save(xmlWriter); //.Save() adds the <xml /> header tag! | |
xmlWriter.Close(); //Must close the writer to dump it's content its output (the memory stream) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// geo-location shim | |
// currentely only serves lat/long | |
// depends on jQuery | |
// doublecheck the ClientLocation results because it may returning null results | |
;(function(geolocation){ | |
if (geolocation) return; |