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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Unit Circle and Sine Wave Animation</title> | |
<style> | |
body { | |
margin: 0; | |
} | |
canvas { | |
display: block; |
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 axios = require('axios'); | |
const cheerio = require('cheerio'); | |
const fs = require('fs'); | |
const path = require('path'); | |
const { URL } = require('url'); | |
// Base URL for the WACE exams directories | |
const BASE_URL = 'https://www.vaultofthewace.xyz/biology/WACE%20exams/'; | |
// Local base directory to save downloaded content |
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 class SomeSingletonService(IServiceScopeFactory serviceScopeFactory) | |
: SingletonService | |
{ | |
protected override async Task ExecuteAsync(CancellationToken stoppingToken) | |
{ | |
using IServiceScope scope = serviceScopeFactory.CreateScope(); | |
var dbContext = scope | |
.ServiceProvider | |
.GetRequiredService<ApplicationDbContext>(); |
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
{ | |
"openapi": "3.0.1", | |
"info": { | |
"title": "Payment Experience API", | |
"description": "This API is meant to be used as a starting point for any new Experience APIs", | |
"contact": { | |
"name": "Thunder Team", | |
"email": "[email protected]" | |
}, | |
"version": "1.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
#region private methods | |
private void RememberCodeVerifier(RedirectToIdentityProviderNotification<OpenIdConnectMessage, OpenIdConnectAuthenticationOptions> n, string codeVerifier) | |
{ | |
var properties = new AuthenticationProperties(); | |
properties.Dictionary.Add("cv", codeVerifier); | |
//if left blank or set to 0, the setting is not used. OOTB default is 15min | |
if(ConfigurationManager.AppSettings[AzureB2CConstants.Keys.NonceLifetime] != null && | |
double.TryParse("30", out double lifetime) && lifetime > 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
//----1----- | |
function SomeComponent() | |
{ | |
return <d><H1>Hellow World</H1><>; | |
} | |
export default SomeComponent; | |
//Concise Way | |
export default SomeComponent() | |
{ |
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
/* | |
Reference | |
https://blog.baslijten.com/federated-authentication-in-sitecore-error-unsuccessful-login-with-external-provider/ | |
*/ | |
public void SignIn(string returnUrl) | |
{ | |
// The param returnUrl is configured in Azure B2C Identity Provider. | |
// The redirect URL is to redirect to externallogincallback method of Sitecore Owin and then load returnUrl Sign-in | |
var properties = new AuthenticationProperties() { RedirectUri = "https://abc/identity/externallogincallback?ReturnUrl=/sign-in" }; | |
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
//Azure AD B2C Owin Context is null , once the token is acquired by authorization code flow | |
//Set Authentication Manager profile | |
var authenticated = HttpContext.GetOwinContext().Authentication.AuthenticateAsync("ExternalCookie"); | |
// Send Access Token bearer to api to get logged user details | |
var loggedInUser = AuthenticationManager.BuildVirtualUser(string.Format(@"{0}\{1}", "external", "User-ID"), true); | |
loggedInUser.RuntimeSettings.AddedRoles.Add(authenticated.Result.Identity.Claims.First().Value); | |
loggedInUser.Profile.FullName = string.Format("{0} {1}", authenticated.Result.Identity.Name, authenticated.Result.Identity.Claims.Last().Value); | |
loggedInUser.Profile.Save(); |
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
Assembly asm = Assembly.GetAssembly(typeof(MyWebDll.MvcApplication)); | |
var controlleractionlist = asm.GetTypes() | |
.Where(type=> typeof(System.Web.Mvc.Controller).IsAssignableFrom(type)) | |
.SelectMany(type => type.GetMethods(BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.Public)) | |
.Where(m => !m.GetCustomAttributes(typeof( System.Runtime.CompilerServices.CompilerGeneratedAttribute), true).Any()) | |
.Select(x => new {Controller = x.DeclaringType.Name, Action = x.Name, ReturnType = x.ReturnType.Name, Attributes = String.Join(",", x.GetCustomAttributes().Select(a => a.GetType().Name.Replace("Attribute",""))) }) | |
.OrderBy(x=>x.Controller).ThenBy(x => x.Action).ToList(); |
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 class SessionService : ISessionService | |
{ | |
private readonly ICryptoService _cryptoService; | |
private readonly string _encryptionKey = ConfigurationManager.AppSettings[AppSettingKeys.Common.SessionEncryptionKey]; | |
public SessionService(ICryptoService cryptoService) | |
{ | |
_cryptoService = cryptoService; | |
} |
NewerOlder