sudo apt install zsh-autosuggestions zsh-syntax-highlighting zsh
| declare module 'polka' { | |
| import { Server } from 'net'; | |
| import { IncomingMessage, ServerResponse } from 'http'; | |
| import Trouter from 'trouter'; | |
| export interface IError extends Error { | |
| message: string; | |
| code?: number; | |
| stack?: string; | |
| status?: number; |
| === RUN TestGetPointsByDistance | |
| Inserted new Point. f0cfed41-fba5-4a2d-8179-9737b631d3c1 | |
| <nil> | |
| [{2d91d952-2825-4a28-ae53-5a58656c4f68 {Point [12.002 12]}} {f0cfed41-fba5-4a2d-8179-9737b631d3c1 {Point [12.002 12]}}] | |
| --- PASS: TestGetPointsByDistance (0.00s) |
| // This is the index.js file for my Parse Live Query Server, running on a separate EC2 instance | |
| var express = require('express'); | |
| var cors = require('cors') | |
| var ParseServer = require('parse-server').ParseServer; | |
| var app = express(); | |
| app.use(cors()); | |
| // We include the lines below so that we can hit `/` and it passes the Elastic Beanstalk Health Check |
| import React, { PureComponent } from 'react' | |
| import Grid from 'material-ui/Grid' | |
| import { CardNumberElement, CardExpiryElement, CardCVCElement } from 'react-stripe-elements' | |
| import StripeElementWrapper from './StripeElementWrapper' | |
| export default class extends PureComponent { | |
| static displayName = 'StripeCardsSection' |
| var express = require('express'); | |
| var path = require('path'); | |
| var favicon = require('serve-favicon'); | |
| var logger = require('morgan'); | |
| var cookieParser = require('cookie-parser'); | |
| var bodyParser = require('body-parser'); | |
| var index = require('./routes/index'); | |
| var user = require('./routes/user'); | |
| var auth = require('./routes/auth'); |
| ## Generate a key | |
| # openssl rand -base64 741 > mongodb-keyfile | |
| ## Create k8s secrets | |
| # kubectl create secret generic mongo-key --from-file=mongodb-keyfile | |
| --- | |
| apiVersion: v1 | |
| kind: Service | |
| metadata: | |
| name: mongo | |
| labels: |
| const buffer = require('buffer'); | |
| const crypto = require('crypto'); | |
| // Demo implementation of using `aes-256-gcm` with node.js's `crypto` lib. | |
| const aes256gcm = (key) => { | |
| const ALGO = 'aes-256-gcm'; | |
| // encrypt returns base64-encoded ciphertext | |
| const encrypt = (str) => { | |
| // The `iv` for a given key must be globally unique to prevent |
This Gist provides some code examples of how to implement WebSocket stream handling using a Redux middleware. Please be aware that this is only provided as an example and that critical things like exception handling have not been implemented.
A more complete version has been packaged, tested, and is available on GitHub as redux-websocket. This library has also been published to npm at @giantmachines/redux-websocket.
This module represents the foundation of the middleware and implements the ideas presented above. The exported function is used during the creation of the Redux store (see the following snippet).