Skip to content

Instantly share code, notes, and snippets.

View aaronolds's full-sized avatar

Aaron.Olds aaronolds

  • Michigan
View GitHub Profile
@aaronolds
aaronolds / Get Stored Proc from DB
Last active August 29, 2015 14:09
Get Stored Procedures from Database
SELECT
r.LAST_ALTERED,
r.ROUTINE_NAME,
OBJECT_DEFINITION (OBJECT_ID(CONCAT(r.SPECIFIC_SCHEMA,'.',r.ROUTINE_NAME)))
FROM INFORMATION_SCHEMA.Routines r
Get-ChildItem "[starting path]" -recurse -Filter [filter] | Select-String -pattern “[pattern in file filtered files]” | group path | select name
@aaronolds
aaronolds / Don't fight it
Last active August 29, 2015 14:12
Breezejs... the hard way
When using Breezejs DO NOT USE DTO (Data Transfer Objects). It is not worth the hell you will go through to make it work.
Look at this post by Ward Bell:
http://neverindoubtnet.blogspot.com/2013/02/the-breeze-server-it-your-way.html
And this post by Julie Lerman
http://msdn.microsoft.com/en-us/magazine/jj883952.aspx
@aaronolds
aaronolds / ISNULL vs COALESCE
Created December 30, 2014 21:50
MS SQL - What will the output be?
DECLARE @test VARCHAR(2)
print ISNULL(@test, 'test')
print COALESCE(@test, 'test')
@aaronolds
aaronolds / SetValue.cs
Last active September 22, 2015 21:19
Convert and set properties dynamically on Entity Framework Models
public static void SetValue<T>(T obj, string fieldName, object value)
{
var type = typeof(T);
// Get our property via reflection so that we can invoke methods against property
var prop = type.GetProperty(fieldName, BindingFlags.Public | BindingFlags.Instance);
if (prop == null || !prop.CanWrite) return;
// Gets what the data type is of our property (Foreign Key Property)
var propertyType = prop.PropertyType;
@aaronolds
aaronolds / ConvertBitArrayToHexString.cs
Created November 18, 2015 03:10
Convert byte array to Hex String
BitConverter.ToString(md5Hash).Replace("-", string.Empty));
(dir -include *.cs -recurse | select-string .).Count

Keybase proof

I hereby claim:

  • I am aaronolds on github.
  • I am aaronolds (https://keybase.io/aaronolds) on keybase.
  • I have a public key whose fingerprint is 84C5 5C94 D0A8 4B01 ECCD EC4C 3647 12AC 2974 5965

To claim this, I am signing this object:

@aaronolds
aaronolds / serialize.cs
Created July 21, 2016 19:31
Serialize object from Immediate Window in Visual Studio
// http://stackoverflow.com/questions/18794264/visual-studio-how-to-serialize-object-from-debugger
// replace obj with the object you want to serialize
(new System.Xml.Serialization.XmlSerializer(obj.GetType())).Serialize(new System.IO.StreamWriter(@"c:\temp\text.xml"), obj)
@aaronolds
aaronolds / Change create time of folder
Created August 5, 2016 20:34
Change create time of folder
Set-ItemProperty -path .\[folder]\ -Name Creationtime -Value '[new date]'