Skip to content

Instantly share code, notes, and snippets.

Avatar

Judah Gabriel Himango JudahGabriel

View GitHub Profile
@JudahGabriel
JudahGabriel / Resources.md
Last active Oct 17, 2020
Building rich app experiences with Progressive Web apps
View Resources.md
@JudahGabriel
JudahGabriel / styles.css
Created Apr 13, 2020
Shows how to style <pwa-auth> using shadow parts
View styles.css
/* The Sign In button itself */
pwa-auth::part(signInButton) {
color: white;
background-color: green;
transform: rotate3d(0, 0, 1, 10deg);
}
/* The MS button */
pwa-auth::part(microsoftButton) {
color: teal;
@JudahGabriel
JudahGabriel / index.html
Created Apr 13, 2020
pwa-auth with prompt credential mode
View index.html
<pwa-auth
credentialmode="prompt"
microsoftkey="..."
googlekey="..."
facebookkey="...">
</pwa-auth>
@JudahGabriel
JudahGabriel / index.html
Created Apr 13, 2020
pwa-auth in headless (no UI) mode
View index.html
<pwa-auth appearance="none"></pwa-auth>
<button id="myBtn">My Own Sign In Button</button>
<script>
// Hook up our own button to pwa-auth sign-in flow
const pwaAuth = document.querySelector("pwa-auth");
const myBtn = document.querySelector("#myBtn");
myBtn.addEventHandler("click", () => pwaAuth.signIn("Microsoft")); // Or Google or Facebook
</script>
@JudahGabriel
JudahGabriel / index.html
Created Apr 13, 2020
pwa-auth rendering as a list of buttons
View index.html
<pwa-auth
appearance="list"
microsoftkey="..."
googlekey="..."
facebookkey="...">
</pwa-auth>
@JudahGabriel
JudahGabriel / index.html
Created Apr 13, 2020
Adding <pwa-auth> sign-in button to your page
View index.html
<!-- To create a key, see https://github.com/pwa-builder/pwa-auth#creating-keys -->
<pwa-auth
microsoftkey="..."
googlekey="..."
facebookkey="...">
</pwa-auth>
@JudahGabriel
JudahGabriel / index.html
Created Apr 13, 2020
Code to add pwa-auth web component to your page
View index.html
<script type="module" src="https://cdn.jsdelivr.net/npm/@pwabuilder/pwaauth/dist/pwa-auth.js"></script>
@JudahGabriel
JudahGabriel / main.js
Created Apr 7, 2020
pwa-auth: Listening for signin-completed event
View main.js
const pwaAuth = document.querySelector("pwa-auth");
pwaAuth.addEventListener("signin-completed", ev => {
const signIn = ev.detail;
if (signIn.error) {
console.error("Sign in failed", signIn.error);
} else {
console.log("Email: ", signIn.email);
console.log("Name: ", signIn.name);
console.log("Picture: ", signIn.imageUrl);
console.log("Provider (MS, Google, FB): ", signIn.provider);
@JudahGabriel
JudahGabriel / CowboysController.cs
Created Aug 1, 2019
Querying for orange-lovin' cowboys in a RavenDB Cloud cluster
View CowboysController.cs
using (var session = raven.OpenSession())
{
var cowboys = session.Query<Cowboy>().Where(c => c.FavoriteColor == "Orange");
}
@JudahGabriel
JudahGabriel / CowboysController.cs
Created Aug 1, 2019
Saving a real Cowboy to a RavenDB Cloud cluster
View CowboysController.cs
using (var session = raven.OpenSession())
{
var cowboy = new Cowboy
{
Name = "Maunder, C.",
FavoriteColor = "Orange"
};
session.Store(outlaw);
session.SaveChanges();
}
You can’t perform that action at this time.