Skip to content

Instantly share code, notes, and snippets.

View Gr8Gatsby's full-sized avatar
🎯
Focusing

Kevin Hill Gr8Gatsby

🎯
Focusing
View GitHub Profile
https://ascii-generator.site/
░░░░░░░░░░░░▄▄░░░░░░░░░
░░░░░░░░░░░█░░█░░░░░░░░
░░░░░░░░░░░█░░█░░░░░░░░
░░░░░░░░░░█░░░█░░░░░░░░
░░░░░░░░░█░░░░█░░░░░░░░
███████▄▄█░░░░░██████▄░
▓▓▓▓▓▓█░░░░░░░░░░░░░░█░
▓▓▓▓▓▓█░░░░░░░░░░░░░░█░
import Handlebars from "https://esm.sh/handlebars";
const template = Handlebars.compile(`
<style>
body{
font-family: arial;
font-size: small;
}
.box {
border-radius:10px;
import Handlebars from "https://esm.sh/handlebars";
Handlebars.registerHelper("AQI", function(aqi){
if(aqi > 50){
return 'moderate';
} else if (aqi > 100){
return 'unhealthy-sensitive';
} else if (aqi > 150){
return 'unhealthy';
} else if (aqi > 200){
@Gr8Gatsby
Gr8Gatsby / gist:49e2b58e3f7f7818d423b50142504653
Created February 17, 2023 09:53
SpaceX Lauches Data Visualizer Handlebars
import Handlebars from "https://esm.sh/handlebars";
console.log(Handlebars)
const template = Handlebars.compile(`
<div>{{data.name}}</div>
{{#each data.crew}}
<li>{{role}}</li>
{{/each}}
`);
Rapid.onResponse(async (res) => {
const main = document.querySelector("main");
if (!res) {
main.innerHTML = "<pre>Response is empty</pre>";
return;
}
const data = await res.json();
main.innerHTML =
`<div> ${data.results[0].name.first} ${data.results[0].name.last} </div>
@Gr8Gatsby
Gr8Gatsby / toast.js
Last active January 24, 2020 11:09
Create a custom toast message and respond to the activation event recieved from the user selection.
(function () {
"use strict";
function createToast(message, imgUrl, imgAlt) {
// Namespace: Windows.UI.Notifications
if (typeof Windows !== 'undefined' &&
typeof Windows.UI !== 'undefined' &&
typeof Windows.UI.Notifications !== 'undefined') {
// Setup variables for shorthand
var notifications = Windows.UI.Notifications,
@Gr8Gatsby
Gr8Gatsby / default.css
Last active August 29, 2015 14:24
This is showing how to use tryEnterFullScreen() from Windows.UI.ViewManagement.ApplicationView.getForCurrentView();
.hide {
display:none;
}
.show {
display:block;
}
.message {
font-family:'Segoe UI', Arial, Helvetica, sans-serif;
@Gr8Gatsby
Gr8Gatsby / SystemBackButton.js
Created June 30, 2015 22:20
This Gist shows you how to integrate with the AppTitleBar Back button for Windows 10 JavaScript Apps.
// Hardcoded Navigation Stack
var navigationStack = [
{ "url": "http://www.bing.com" },
{ "url": "http://www.msn.com" }
]
// GoBack function
function goBack() {
var place = navigationStack.pop();
// TODO: Navigate to place.url;
@Gr8Gatsby
Gr8Gatsby / changeAppTitleBarColors.js
Created June 30, 2015 21:43
This Gist shows how to set the application titlebar colors. There is a helper function that accepts an HTML hexString and converts it to an RGBA color object for Windows.
/*
This function expects two hexStrings and relies on hexStrToRGBA to convert
to a JSON object that represents RGBA for the underlying Windows API to
understand.
Examples of valid values:
setAppBarColors('#FFFFFF','#000000');
setAppBarColors('#FFF','#000');
setAppBarColors('FFFFFF','000000');
setAppBarColors('FFF','000');
@Gr8Gatsby
Gr8Gatsby / createToast.js
Created June 29, 2015 00:46
This Gist shows how to create a simple toast message on Windows using JavaScript.
function createToast(message, imgUrl, imgAlt) {
// Namespace: Windows.UI.Notifications
if (typeof Windows.UI.Notifications === 'undefined') {
return;
}
// Setup variables for shorthand
var notifications = Windows.UI.Notifications,
templateType = notifications.ToastTemplateType.toastImageAndText01,
templateContent = notifications.ToastNotificationManager.getTemplateContent(templateType),
toastMessage = templateContent.getElementsByTagName('text'),