Skip to content

Instantly share code, notes, and snippets.

View JudahGabriel's full-sized avatar

Judah Gabriel Himango JudahGabriel

View GitHub Profile
@JudahGabriel
JudahGabriel / Resources.md
Last active October 26, 2021 17:58
Building rich app experiences with Progressive Web apps
@JudahGabriel
JudahGabriel / styles.css
Created April 13, 2020 23:08
Shows how to style <pwa-auth> using shadow parts
/* 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 April 13, 2020 22:30
pwa-auth with prompt credential mode
<pwa-auth
credentialmode="prompt"
microsoftkey="..."
googlekey="..."
facebookkey="...">
</pwa-auth>
@JudahGabriel
JudahGabriel / index.html
Created April 13, 2020 20:35
pwa-auth in headless (no UI) mode
<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 April 13, 2020 20:22
pwa-auth rendering as a list of buttons
<pwa-auth
appearance="list"
microsoftkey="..."
googlekey="..."
facebookkey="...">
</pwa-auth>
@JudahGabriel
JudahGabriel / index.html
Created April 13, 2020 19:59
Adding <pwa-auth> sign-in button to your page
<!-- 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 April 13, 2020 19:54
Code to add pwa-auth web component to your page
<script type="module" src="https://cdn.jsdelivr.net/npm/@pwabuilder/pwaauth/dist/pwa-auth.js"></script>
@JudahGabriel
JudahGabriel / main.js
Created April 7, 2020 21:56
pwa-auth: Listening for signin-completed event
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 August 1, 2019 20:50
Querying for orange-lovin' cowboys in a RavenDB Cloud cluster
using (var session = raven.OpenSession())
{
var cowboys = session.Query<Cowboy>().Where(c => c.FavoriteColor == "Orange");
}
@JudahGabriel
JudahGabriel / CowboysController.cs
Created August 1, 2019 20:49
Saving a real Cowboy to a RavenDB Cloud cluster
using (var session = raven.OpenSession())
{
var cowboy = new Cowboy
{
Name = "Maunder, C.",
FavoriteColor = "Orange"
};
session.Store(outlaw);
session.SaveChanges();
}