Skip to content

Instantly share code, notes, and snippets.

View modster's full-sized avatar
🧠

EM Greeff modster

🧠
View GitHub Profile
@modster
modster / candlesticks.html
Created December 18, 2021 04:29
candlesticks
<div id="observablehq-6309a52d"></div>
<p>Credit: <a href="https://observablehq.com/@modster/candlestick-chart">Candlestick Chart by MichaelGreeff</a></p>
<script type="module">
import {Runtime, Inspector} from "https://cdn.jsdelivr.net/npm/@observablehq/runtime@4/dist/runtime.js";
import define from "https://api.observablehq.com/@modster/candlestick-chart.js?v=3";
new Runtime().module(define, Inspector.into("#observablehq-6309a52d"));
</script>
@modster
modster / project-euler.html
Created December 18, 2021 09:21
Project Euler
<div id="observablehq-a51265f7"></div>
<p>Credit: <a href="https://observablehq.com/@tmcw/project-euler-https-projecteuler-net">Project Euler by Tom MacWright</a></p>
<script type="module">
import {Runtime, Inspector} from "https://cdn.jsdelivr.net/npm/@observablehq/runtime@4/dist/runtime.js";
import define from "https://api.observablehq.com/@tmcw/project-euler-https-projecteuler-net.js?v=3";
new Runtime().module(define, Inspector.into("#observablehq-a51265f7"));
</script>
@modster
modster / index.html
Created December 18, 2021 15:12
Electron Fiddle Gist
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
</head>
<body>
<h1>Hello World!</h1>
<p>
@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>
@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 / 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 / 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 / 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',

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
 }
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>