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 ObjectExtend | |
| { | |
| public static dynamic Extend(this object source, params object[] objs) | |
| { | |
| var result = new ExpandoObject(); | |
| var props = (IDictionary<string, object>)result; | |
| foreach (var o in new[] { source }.Union(objs)) | |
| { | |
| var expandoProperties = ( |
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
| const usingSorter = <T>(...selectors: ((t: T) => string | number)[]) => (a: T, b: T): -1 | 0 | 1 => { | |
| for (const selector of selectors) { | |
| const sa = selector(a) | |
| const sb = selector(b) | |
| if (sa < sb) return -1 | |
| if (sa > sb) return 1 | |
| } | |
| return 0 | |
| } |
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
| CREATE PROCEDURE DropUnnamedDefaultConstraint (@Table NVARCHAR(MAX), @Column NVARCHAR(MAX)) | |
| AS | |
| BEGIN | |
| DECLARE @Drop NVARCHAR(MAX) = ( | |
| SELECT TOP 1 'ALTER TABLE ' + @Table + ' DROP CONSTRAINT '+name | |
| FROM sys.default_constraints A | |
| JOIN sysconstraints B on A.parent_object_id = B.id | |
| WHERE id = OBJECT_ID(@Table) | |
| AND COL_NAME(id, colid) = @Column | |
| AND OBJECTPROPERTY(constid, 'IsDefaultCnst') = 1 |
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
| using System; | |
| using System.Collections.Generic; | |
| using System.IO; | |
| using System.Linq; | |
| using System.Text; | |
| //------------------------------------------------------- | |
| // You'll need this thing from Symantec! | |
| //------------------------------------------------------- | |
| using com.symantec.scanengine.api; |
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
| // Only here because the library doesn't provide an enum or anything. | |
| public static class StorageAccountType | |
| { | |
| public readonly static string LocallyRedundant = "Standard_LRS"; | |
| public readonly static string GeographicallyRedundant = "Standard_GRS"; | |
| public readonly static string ReadAccessGeographicallyRedundant = "Standard_RAGRS"; | |
| public readonly static string ZoneRedundant = "Standard_ZRS"; | |
| } |
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
| var ClientSecret = "kSRsdf7rU323rf2ff2gfdssfdAnKI1mcOf98djfidIGx38="; // A key you add for your AAD app. | |
| var ClientId = "17dfab36-1c33-4ffe-9ddd-533ddddfs378"; // The unique identifier for your AAD app.. | |
| var userObjectId = "12345667-1234-1234-1234-123412341234"; // LET'S SAY YOU WANNA GET A USER'S GROUPS... You'll need their ObjectId for querying later. | |
| var authority = "https://login.microsoftonline.com/{tenant guid}/oauth2/authorize?api-version=1.0"; // This is the "OAuth Authorize" Endpoint for your AAD app. | |
| var authContext = new AuthenticationContext(authority); | |
| // Graph endpoint comes from Azure Portal "Graph Connection Endpoint" | |
| var client = new ActiveDirectoryClient(new Uri("https://graph.windows.net/{tenant guid}"), () => |
NewerOlder