This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
importScripts( | |
"https://storage.googleapis.com/workbox-cdn/releases/6.0.2/workbox-sw.js" | |
); | |
// Note: Ignore the error that Glitch raises about workbox being undefined. | |
workbox.setConfig({ | |
debug: true, | |
}); | |
self.skipWaiting(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Registers a valid service worker. | |
* | |
* @param {string} swUrl - url of the service worker. | |
* @param {Object} [config] - functions that will trigger on success or update. | |
* @param {(registration: ServiceWorkerRegistration) => void} [config.onSuccess] - after the service worker is installed successfully this callback will be called. | |
* @param {(registration: ServiceWorkerRegistration) => void} [config.onUpdate] - after the service worker is updated successfully this callback will be called. | |
*/ | |
function registerValidSW(swUrl, config) { | |
return navigator.serviceWorker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3.3" | |
services: | |
db: | |
image: mysql | |
command: --default-authentication-plugin=mysql_native_password | |
volumes: | |
- ./mysql-dump:/docker-entrypoint-initdb.d | |
environment: | |
MYSQL_DATABASE: "tutorial" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import defaultImage from "./default-profile.jpg"; | |
function If (props) { | |
if (!props.condition) { | |
return <>{ null }</>; | |
} | |
return <>{ props.children }</>; | |
} | |
function ImageUpload () { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { FormEvent } from "react"; | |
import "./styles.scss"; | |
export interface Pics { | |
id: number; | |
path: string; | |
alt: string; | |
} | |
export interface CarouselProps { | |
pics: Pics[]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const crypto = require("crypto"); | |
const algorithm = "aes-256-cbc"; | |
const iv = "%i!>Z+e" | |
const key = "7xFx-oli,Szlc%5D/k0&vq4b" | |
function scrypt (num, secret) { | |
return new Promise((res, rec) => { | |
return crypto.scrypt(secret, "salt", num, (err, key) => { | |
if (err) return rec(err); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function encryptText (toEncript) { | |
let i, k; | |
return getIv() | |
.then(iv => { | |
i = iv; | |
return getKey() | |
}).then(key => { | |
k = key; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { AccountAttributes, Repository } from "@eneto/models"; | |
import { DataTypes, Sequelize } from "sequelize"; | |
/** | |
* Account factory | |
* | |
* @param {import("sequelize").Sequelize} sequelize Sequelize database instance. | |
* @returns {Repository<AccountAttributes>} Instance of Accounts Entity. | |
*/ | |
function AccountFactory(sequelize: Sequelize): Repository<AccountAttributes> { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { connect } from "react-redux"; | |
import { AppState } from "@eneto/api-client"; | |
import { LandingPage } from "../components/lists"; | |
import { lists } from "../modules/lists"; | |
import { listsAction } from "../modules/lists/lists-actions"; | |
const stateToProps = (state: AppState) => ({ | |
lists: [...lists(state)], | |
}); | |
const dispatchToProps = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from "react"; | |
import * as Loadable from "react-loadable"; | |
const Loading = (): React.ReactElement => <span>Loadong</span>; | |
export const List = Loadable({ | |
loader: () => import(/* webpackChunkName: "lists" */ "./list-constainer"), | |
loading: Loading, | |
}); |
NewerOlder