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
1. Create an app registration in Azure Active Directory (Can also create from SPO using _layouts/15/appregnew.aspx) | |
a. Under "Authentication", make sure implicit grants are all checked (access tokens and id tokens) | |
b. Under "Certificates & secrets", create a secret (jot it down!) | |
c. Under "API permissions", add SharePoint appropriate permissions | |
2. Go to SPO instance app inventory: https://<tenant>.sharepoint.com/_layouts/15/appinv.aspx | |
a. UNKONWN: in order to create the app registration on SPO, a secret is required. For some reason, the secret created in the previous | |
step (1b) is not the correct format. I've generated a secret and re-created a secret using 1b. I THINK, both secrets would work, | |
but in my test case, i ended up using the 2nd secret I created under 1b. | |
b. Fill in details and add permissions xml (https://docs.microsoft.com/en-us/sharepoint/dev/solution-guidance/security-apponly-azureacs) |
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
/****** | |
An example to automatically perform datetime conversions using automapper | |
Assumptions: | |
* all inputs are in client Local time (MyInputModel) | |
* all datetimes are stored as UTC (MyDto) | |
* all datetimes retrieved from storage are in UTC and contain the destination timezone (MyDto) | |
* if destination not supplied, use the server local time zone | |
*******/ |
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
$targDir = "C:\inetpub\websites\ADA*\"; | |
$subDir = $(Get-ChildItem "$targDir"); | |
foreach($sub in $subDir) { | |
$files = $(Get-Childitem $sub -Filter app_offline*.htm); | |
foreach($file in $files) { | |
$oldname = $file.FullName; |
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
$targDir = "C:\dev\LMS-client-ADA"; | |
Get-ChildItem $targDir -Filter *.pdf | | |
Foreach-Object { | |
$oldname = $_.FullName; | |
$newname = $_.FullName.Replace(" ", "_"); | |
$newname = $newname -replace "[0-9]+\-[0-9]+\-[0-9]+_", ""; | |
Rename-Item $oldname $newname; |
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
// I'm not sure if this is the best or most correct way to do it, but it seems to work in my prototype. | |
// Basically, I want "dependency injection" for my controller, and after reading some tech blogs online, | |
// it seems like the best way to do this is to use IHttpControllerActivator to inject dependencies into | |
// your controller because you will have context of the request doing it this way as opposed to doing it | |
// via traditional dependency injection. | |
// this code in Global.asax.cs | |
public WebApiApplication() | |
{ | |
this.container = new UnityContainer(); |
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
// lifted from http://stackoverflow.com/a/10130176/4040187 | |
public class StringPropertyTruncateSpecimenBuilder<TEntity> : ISpecimenBuilder | |
{ | |
private readonly int _length; | |
private readonly PropertyInfo _prop; | |
public StringPropertyTruncateSpecimenBuilder(Expression<Func<TEntity, string>> getter, int length) | |
{ | |
_length = length; | |
_prop = (PropertyInfo)((MemberExpression)getter.Body).Member; |
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
SET @StartDate = CONVERT(DATETIME, CONVERT(VARCHAR, MONTH(@StartDate)) + '/1/' + CONVERT(VARCHAR, YEAR(@StartDate))); | |
-- get a table of all of the month ends between @startDate and @endDate | |
CREATE TABLE #MonthEnds ( | |
MonthEnd DATETIME | |
); | |
INSERT INTO #MonthEnds (MonthEnd) | |
SELECT TOP (DATEDIFF(MONTH, @StartDate, @EndDate)+1) | |
DATEADD( | |
DAY, |
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
/* | |
Found on http://ejohn.org/blog/learning-from-twitter/ | |
- neat way for performant JS when needing to bind on window scroll | |
*/ | |
var outerPane = $details.find(".details-pane-outer"), | |
didScroll = false; | |
$(window).scroll(function() { | |
didScroll = true; |
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
import os | |
import json | |
def printJsonData(filename): | |
file = open(filename) | |
jsonString = file.read() | |
jsonString = jsonString.replace('\'', '"') | |
#print(jsonString) | |
jsonObject = json.loads(jsonString) | |
print(jsonObject['Namespace'] , '|', jsonObject['ProcPrefix']) |
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 myNamespace = (function() { | |
// private functions for your namespace | |
var getSelText = function() { | |
... | |
}; | |
return { | |
run: function() { | |
var selectedText = getSelText(); | |
alert (selectedText); |
NewerOlder