Skip to content

Instantly share code, notes, and snippets.

View evuazeze's full-sized avatar
💭
Sound Track

Emmanuel Evuazeze evuazeze

💭
Sound Track
View GitHub Profile
"""
:type firstname: {String}
:type lastname: {String}
:type age: {Integer}]
"""
def my_string_formatting(firstname, lastname, age):
print(f"Hello, my name is {firstname} {lastname}, I'm {age}")
@evuazeze
evuazeze / main.js
Last active November 20, 2018 17:50
...
handleConnectionChange = (event) => {
if(event.type == "online"){
// Setup the request
var headers = new Headers();
// Set some Headers
headers.set('Accept', 'application/json');
// Get Data from indexedDB
@evuazeze
evuazeze / main.js
Last active November 20, 2018 16:15
...
failedPostListener = () => {
navigator.serviceWorker.addEventListener('message', event => {
var form = document.getElementById('form');
// Alert displays the message sent from our service worker
alert(event.data.msg);
// Assuming personal-details database have been created with
@evuazeze
evuazeze / sw.js
Last active November 20, 2018 15:52
self.addEventListener('fetch', function(event) {
var request = event.request;
if (request.method === "POST") {
event.respondWith(
// Try to POST form data to server
fetch(event.request)
.catch(function() {
// If it doesn't work, post a message to reassure user
self.clients.matchAll().then(function (clients){
@evuazeze
evuazeze / main.js
Last active November 20, 2018 17:33
/**
* Create form as soon as the page is loaded.
*/
document.addEventListener('DOMContentLoaded', (event) => {
createForm();
});
createForm = () => {
const container = document.querySelector('#form-container');
@evuazeze
evuazeze / index.html
Last active November 20, 2018 12:38
App Shell for example form
<!DOCTYPE html>
<html>
<head>
<title>Offline POSTs</title>
</head>
<body>
<section id="form-container"></section>
</body>
<script src="main.js"></script>
</html>
let restaurant;
var newMap;
var formEl = document.getElementById('form');
/**
* Initialize map as soon as the page is loaded.
*/
document.addEventListener('DOMContentLoaded', (event) => {
initMap();
});
@evuazeze
evuazeze / radiogroup.js
Last active July 26, 2018 06:39
Trying to wrap my head around this code from lesson 11 >> 14. Quiz: Implementing Keyboard Event Listeners. Anyone knows what focusedIdx represents or what it does?
(function() {
'use strict';
// Define values for keycodes
var VK_ENTER = 13;
var VK_SPACE = 32;
var VK_LEFT = 37;
var VK_UP = 38;
var VK_RIGHT = 39;
var VK_DOWN = 40;