Skip to content

Instantly share code, notes, and snippets.

@asith-w
asith-w / ThemeManager.ts
Created February 20, 2022 20:24
ThemeManager.ts
export enum TeamsTheme {
default,
dark,
contrast
}
export class ThemeManager {
public static applyTeamsTheme(teamsTheme: TeamsTheme) {
let theme = {
name: "Teams",
palette: {}
@asith-w
asith-w / .json
Created June 1, 2020 05:49
appsettings.json
{
"AzureAd": {
// Azure cloud instance among:
// - "https://login.microsoftonline.com/" for Azure public cloud
// - "https://login.microsoftonline.us/" for Azure US government
// - "https://login.microsoftonline.de/" for Azure AD Germany
// - "https://login.chinacloudapi.cn/" for Azure AD China operated by 21Vianet
"Instance": "https://login.microsoftonline.com/",
// Azure AD audience among:
@asith-w
asith-w / .cs
Created May 20, 2020 19:00
github-issue
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
var tenantIds = new List<string>{
"1448f51b-234d-123345-86c8-0f6a634bbbb1",
"2448f51b-234d-123345-86c8-0f6a634bbbb2",
"3448f51b-234d-123345-86c8-0f6a634bbbb3",
"4448f51b-234d-123345-86c8-0f6a634bbbb4",
"5448f51b-234d-123345-86c8-0f6a634bbbb5"
};
https://graph.microsoft.com/v1.0/me/events/AQMkADU2OWFjYTFjLWNkMGYtNDdlNS1hNDIxLWIxYjlmYWNhYmE5YQBGAAADqyJu-WyzJk6m5v0MbSs7lwcASdXmMkSN8kCNtzTsQ4x1lwAAAgENAAAASdXmMkSN8kCNtzTsQ4x1lwAEdsjaqgAAAA==?$expand=singleValueExtendedProperties($filter=id eq 'String {66f5a359-4659-4830-9070-00040ec6ac6e} Name Fun')
public class HtmlHelper
{
string _attrib = string.Empty;
public string AddAttribute(string source, string tagName, string attrib)
{
_attrib = attrib;
string term = "<" + tagName + " [^>]+>";
@asith-w
asith-w / Ex15_SyncMailboxes_CS.cs
Created November 21, 2016 06:04
MSDN Example - Exchange 2013: Synchronize a mailbox programmatically
using System;
using Microsoft.Exchange.WebServices.Data;
namespace Exchange101
{
class Ex15_SyncMailboxes_CS
{
// This sample is for demonstration purposes only. Before you run this sample, make sure that the code meets the coding requirements of your organization.
static ExchangeService service = Service.ConnectToService(UserDataFromConsole.GetUserData(), new TraceListener());
@asith-w
asith-w / JavaScript oAuth Popup Window Handler Code.js
Created September 13, 2016 12:14
JavaScript oAuth Popup Window Handler Code
//Authorization popup window code
function ShowAuthWindow(options)
{
console.log('ee');
options.windowName = options.windowName || 'ConnectWithOAuth'; // should not include space for IE
options.windowOptions = options.windowOptions || 'location=0,status=0,width=800,height=400';
options.callback = options.callback || function(){ window.location.reload(); };
var that = this;
console.log(options.path);
that._oauthWindow = window.open(options.path, options.windowName, options.windowOptions);
@asith-w
asith-w / CamelCase notation.CS
Created August 31, 2016 04:58
C# -json JsonSerializerSettings
Product product = new Product
{
ExpiryDate = new DateTime(2010, 12, 20, 18, 1, 0, DateTimeKind.Utc),
Name = "Widget",
Price = 9.99m,
Sizes = new[] {"Small", "Medium", "Large"}
};
string json =
JsonConvert.SerializeObject(
@asith-w
asith-w / forceToDownload.js
Created April 27, 2016 06:07
forceToDownload.js
var link = $("<a />");
link.appendTo("body");
link.attr("id", "csvDwnLink");
window.URL = window.URL || window.webkitURL;
var csv = "\ufeff" + "col1;col2;col3",
blob = new window.Blob([csv], {type: 'text/csv, charset=UTF-8'}),
csvUrl = window.URL.createObjectURL(blob),
filename = 'export.csv';
@asith-w
asith-w / Prototype-Link.json
Created June 26, 2015 07:04
Prototype-Link.json