This example connects to an imap server and retrieves emails
npm install imap mailparser
import { createCipheriv, createDecipheriv, randomBytes } from "crypto"; | |
const ENCRYPTION_KEY: string = process.env.ENCRYPTION_KEY || ""; // Must be 256 bits (32 characters) | |
const IV_LENGTH: number = 16; // For AES, this is always 16 | |
/** | |
* Will generate valid encryption keys for use | |
* Not used in the code below, but generate one and store it in ENV for your own purposes | |
*/ | |
export function keyGen() { |
import path from 'path'; | |
import express from 'express'; | |
import { merge } from 'lodash'; | |
import graphqlHTTP from 'express-graphql'; | |
import PrettyError from 'pretty-error'; | |
import expressHttpProxy from 'express-http-proxy'; | |
import bodyParser from 'body-parser'; | |
import raven from 'raven'; | |
import morgan from 'morgan'; | |
import { PORT, PUBLIC_URL } from 'config'; |
This example connects to an imap server and retrieves emails
npm install imap mailparser
// обычная семья | |
// U+1F46A | |
> 👪 | |
// ZWJ-последовательность: семья (мужчина, женщина, мальчик) | |
// U+1F468 + U+200D + U+1F469 + U+200D + U+1F466 | |
// 👨 + U+200D + 👩 + U+200D + 👦 | |
> 👨👩👦 | |
// ZWJ-последовательность: семья (женщина, женщина, девочка) |
//you do not necessary need all of the following, i copy/pasted a piece from | |
//one of my projects. | |
var express = require('express'); | |
var fs = require('fs'); | |
var Busboy = require('busboy'); | |
var mime = require('mime'); | |
var https = require('https'); | |
var querystring = require('querystring'); | |
var router = express.Router(); |
import r from "rethinkdb"; | |
import restify from "restify"; | |
import testData from "./testData"; | |
function addTestData(conn, tableName) { | |
let insertData = testData[tableName]; | |
r.db("movie_test") | |
.table(tableName) | |
.insert(insertData) |
const fs = require('fs') | |
const ndjson = require('ndjson') | |
const r = require('rethinkdb') | |
const rethinkdbStream = require('rethinkdb-stream') | |
const DB_NAME = 'bbc_broadcasts' | |
const TABLE_NAME = 'broadcasts' | |
const OUTPUT_NAME = 'broadcasts.ndjson' | |
r.connect().then(connection => { |
Most configuration really isn't about the app -- it's about where the app runs, what keys it needs to communicate with third party API's, the db password and username, etc... They're just deployment details -- and there are lots of tools to help manage environment variables -- not the least handy being a simple .env file with all your settings. Simply source the appropriate env before you launch the app in the given env (you could make it part of a launch script, for instance).
env files look like this:
SOMEVAR="somevalue"
ANOTHERVAR="anothervalue"
To source it:
$ source dev.env # or staging.env, or production.env, depending on where you're deploying to
[ Update 2025-03-24: Commenting is disabled permanently. Previous comments are archived at web.archive.org. ]
Most of the terminal emulators auto-detect when a URL appears onscreen and allow to conveniently open them (e.g. via Ctrl+click or Cmd+click, or the right click menu).
It was, however, not possible until now for arbitrary text to point to URLs, just as on webpages.