A brief example on how to use npx to run gist based scripts.
Read the article here https://neutrondev.com/npm-vs-npx-whats-the-difference/ or watch it on YouTube https://www.youtube.com/watch?v=fSHWc8RTJug
| /* | |
| In the node.js intro tutorial (http://nodejs.org/), they show a basic tcp | |
| server, but for some reason omit a client connecting to it. I added an | |
| example at the bottom. | |
| Save the following server in example.js: | |
| */ | |
| var net = require('net'); |
| "workbench.colorCustomizations": { | |
| // Contrast Colors - The contrast colors are typically only set for high contrast themes. If set, they add an additional border around items across the UI to increase the contrast. | |
| "contrastActiveBorder": "", | |
| "contrastBorder": "", | |
| // Base Colors | |
| "focusBorder": "", | |
| "foreground": "", | |
| "widget.shadow": "", | |
| "selection.background": "", | |
| "descriptionForeground": "", |
| <div id="app"> | |
| <h2>Police data for Oxfordshire</h2> | |
| <p>Using data from <a href="https://data.police.uk/docs/method/crime-street/">https://data.police.uk/docs/method/crime-street/</a></p> | |
| <p>Built using <a href="https://vuejs.org/">vue.js</a> and <a href="https://marketplace.visualstudio.com/items?itemName=vsls-contrib.gistfs">gistpad</a></p> | |
| <p>Dataset source <a href="https://data.police.uk/api/crimes-street/all-crime?poly=51.85110973276099,%20-1.4057047320491165:51.86298424914946,%20-1.1282999468928665:51.71262569681858,%20-1.1241800738459915:51.70241375059155,%20-1.3905985308772415:51.850261433101906,%20-1.4043314410334915">https://data.police.uk/api/crimes-street/all-crime?poly=51.85110973276099,%20-1.4057047320491165:51.86298424914946,%20-1.1282999468928665:51.71262569681858,%20-1.1241800738459915:51.70241375059155,%20-1.3905985308772415:51.850261433101906,%20-1.4043314410334915</a></p> | |
| <p>Sample data: <a href="sample.json">sample.json</a></p> | |
| <button @click="clearData">Clear data< |
| var express = require('express'); | |
| var app = express(); | |
| var woodlot = require('woodlot').middlewareLogger; | |
| app.use(woodlot({ | |
| streams: ['./logs/app.log'], | |
| stdout: false, | |
| routes: { | |
| whitelist: ['/api', '/dashboard'], | |
| strictChecking: false |
A brief example on how to use npx to run gist based scripts.
Read the article here https://neutrondev.com/npm-vs-npx-whats-the-difference/ or watch it on YouTube https://www.youtube.com/watch?v=fSHWc8RTJug
| var net = require('net') | |
| var sock = net.connect(1337) | |
| process.stdin.pipe(sock) | |
| sock.pipe(process.stdout) | |
| sock.on('connect', function () { | |
| process.stdin.resume(); | |
| process.stdin.setRawMode(true) |
| license: gpl-3.0 | |
| redirect: https://observablehq.com/@mbostock/epicyclic-gearing |
| <script> | |
| // Grin | |
| // Adds all necessary stuff for you. | |
| import { Overlay } from 'trading-vue-js' | |
| export default { | |
| name: 'Grin', | |
| mixins: [Overlay], | |
| methods: { |
| // 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'; |
| 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> |