Skip to content

Instantly share code, notes, and snippets.

@zprima
zprima / app.js
Created January 27, 2019 12:25
medium_p2_c3
const namedPlaces = [
"Junk Junction",
"Haunted Hills",
"Pleasant Park",
"Lazy Links",
"Risky Reels",
"Wailing Woods",
"Tomato Temple",
"Lonely Lodge",
"Retail Row",
@zprima
zprima / manifest.json
Created January 27, 2019 12:30
medium_p2_c4
{
"name": "FN Jumper",
"short_name": "FN Jumper",
"display": "minimal-ui",
"start_url": "/",
"theme_color": "#673ab6",
"background_color": "#111111",
"icons": [
{
"src": "icon-192.png",
@zprima
zprima / sw.js
Created January 27, 2019 12:33
medium_p2_c5
self.addEventListener('fetch', function (event) {
event.respondWith(
caches.match(event.request).then(function (response) {
return response || fetch(event.request);
})
);
});
self.addEventListener('install', function (e) {
e.waitUntil(
@zprima
zprima / app.js
Created January 27, 2019 12:34
medium_p2_c6
//...
navigator.serviceWorker && navigator.serviceWorker.register('./sw.js').then(function (registration) {
console.log('Excellent, registered with scope: ', registration.scope);
});
@zprima
zprima / index.html
Created April 26, 2019 16:28
medium_p4_c1
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
@zprima
zprima / server.js
Created April 26, 2019 16:30
medium_p4_c2
const CLIENT_ID = 'YOUR CLIENT HERE';
const CLIENT_SECRET = 'YOUR SECRET HERE';
const express = require('express');
const cors = require('cors')
const bodyParser = require('body-parser')
const { google } = require('googleapis');
const app = express();
const port = 8080;
@zprima
zprima / manifest.json
Created April 30, 2019 18:58
medium_p5_c1
{
"name": "Freshness",
"version": "1.0",
"description": "Fresh look at gmail",
"page_action": {
"default_icon": {
"16": "images/get_started16.png",
"32": "images/get_started32.png",
"48": "images/get_started48.png",
"128": "images/get_started128.png"
@zprima
zprima / script.js
Created April 30, 2019 19:03
medium_p5_c2
const FRESHNESS_UI = 'freshness_ui';
// add freeshness_ui class to body
var bodyEle = document.body;
bodyEle.classList.add(FRESHNESS_UI);
// toggle freshness ui class on the body element
function toggleFreshness() {
var status = bodyEle.classList.toggle(FRESHNESS_UI);
// console.log("toggle status", status);
@zprima
zprima / style.css
Created April 30, 2019 19:05
medium_p5_c3
/* hide footer */
/* body.freshness_ui .aeG {
display: none;
} */
/* make some space at bottom */
body.freshness_ui .aeF {
margin-bottom: 50px;
}
@zprima
zprima / server.js
Created May 5, 2019 13:13
medium_p6_c1
const utils = require("./utils.js");
const myClient = require("./client.js");
const WebSocket = require("ws");
const chalk = require("chalk");
const wss = new WebSocket.Server({ port: 8080, clientTracking: true });
function clientConnected(client) {
var colorify = chalk.hex(client.color);