Skip to content

Instantly share code, notes, and snippets.

View modster's full-sized avatar
🧠

EM Greeff modster

🧠
View GitHub Profile
@modster
modster / vite.md
Last active March 5, 2022 21:31
vite

Vite Cheat Sheet

npm init vite web3app

npm install --save-dev @nomiclabs/hardhat-waffle ethereum-waffle chai @nomiclabs/hardhat-ethers ethers @openzeppelin/contracts

npm run dev --host
const express = require('express');
const htm = require('htm');
const vhtml = require('vhtml');
// create an html`` tag function for vhtml:
const html = htm.bind(vhtml);
const App = (props) => html`
<div class="app">
<h1>This is an app</h1>
const express = require('express');
const htm = require('htm');
const vhtml = require('vhtml');
// create an html`` tag function for vhtml:
const html = htm.bind(vhtml);
const App = (props) => html`
<div class="app">
<h1>This is an app</h1>

Vite

Scripts

{
  "scripts": {
    "dev": "vite", // start dev server, aliases: `vite dev`, `vite serve`
    "build": "vite build", // build for production
    "preview": "vite preview" // locally preview production build
 }
@modster
modster / raw.md
Created February 15, 2022 07:44
Raw, Parsed, Destructured, Type Cast Data

Working with JSON

Raw JSON:

{"e":"kline","E":1644909835145,"s":"BTCUSDT","k":{"t":1644909780000,"T":1644909839999,"s":"BTCUSDT","i":"1m","f":1257785664,"L":1257786008,"o":"43581.65000000","c":"43569.89000000","h":"43587.00000000","l":"43568.60000000","v":"8.34228000","n":345,"x":false,"q":"363518.48082610","V":"3.57802000","Q":"155911.17141810","B":"0"}}

Parsed JSON:

{
 e: 'kline',
@modster
modster / service-worker.js
Created January 30, 2022 17:59 — forked from jeffposnick/service-worker.js
Example of InjectManifest in Workbox v5
// Add any other logic here as needed.
import { CacheableResponsePlugin } from 'workbox-cacheable-response/CacheableResponsePlugin';
import { CacheFirst } from 'workbox-strategies/CacheFirst';
import { createHandlerForURL } from 'workbox-precaching/createHandlerForURL';
import { ExpirationPlugin } from 'workbox-expiration/ExpirationPlugin';
import { NavigationRoute } from 'workbox-routing/NavigationRoute';
import { precacheAndRoute } from 'workbox-precaching/precacheAndRoute';
import { registerRoute } from 'workbox-routing/registerRoute';
@modster
modster / Grin.vue
Created January 21, 2022 23:26 — forked from C451/Grin.vue
Grin
<script>
// Grin
// Adds all necessary stuff for you.
import { Overlay } from 'trading-vue-js'
export default {
name: 'Grin',
mixins: [Overlay],
methods: {
@modster
modster / index.js
Created January 21, 2022 08:04
JS Module Imports
// index.html
<script type="importmap">
{
"imports": {
"lodash": "/node_modules/lodash-es/lodash.js"
}
}
</script>
@modster
modster / index.html
Created December 19, 2021 00:34
Electron-WSS
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'">
<link href="./styles.css" rel="stylesheet">
<title>Hello World!</title>
</head>
<body>