For ViM and VSCode.
model<tab>
: defines a modelfield<tab>
: defines a fieldindex<tab>
: defines an indexunique
: defines a unique index
NodeJS is a powerful tool for backend developers, but you must be aware of multi-core processing in order to maximize the potential of your CPU. This NodeJS multi-core feature is mostly used for webservers and NodeJS has already out of the box the cluster
module thereto. Although NodeJS has also out of the box the module threads
used for CPU intensive jobs, it's not so easy to deal with.
Let's create a project that will test a single-thread and a multi-thread application with the task of running N
iterations, each iteration doing heavy data processing and writing some random data to a file, each iteration having a different file.
Create the project:
mkdir test-threads && cd test-threads
npm init -y
The package that linked you here is now pure ESM. It cannot be require()
'd from CommonJS.
This means you have the following choices:
import foo from 'foo'
instead of const foo = require('foo')
to import the package. You also need to put "type": "module"
in your package.json and more. Follow the below guide.await import(…)
from CommonJS instead of require(…)
./* | |
Project Structure: | |
src/ | |
- sass/ | |
- - style.scss | |
- index.html | |
npm start - copies src files to dist/ and starts Browsersync server at localhost:3000 | |
npm run build - copies files to dist/ and autoprefixes/minifies css |
openssl req -x509 -newkey rsa:4096 -sha256 -keyout example.key -out example.crt -subj "/CN=example.com" -days 3650 -passout pass:foobar
openssl x509 -x509toreq -in example.crt -out example.csr -signkey example.key -passin pass:foobar
This guide shows how to set up a bidirectional client/server authentication for plain TLS sockets.
Newer versions of openssl are stricter about certificate purposes. Use extensions accordingly.
Generate a Certificate Authority:
# The command finds the most recent tag that is reachable from a commit. | |
# If the tag points to the commit, then only the tag is shown. | |
# Otherwise, it suffixes the tag name with the number of additional commits on top of the tagged object | |
# and the abbreviated object name of the most recent commit. | |
git describe | |
# With --abbrev set to 0, the command can be used to find the closest tagname without any suffix: | |
git describe --abbrev=0 | |
# other examples |
<?php | |
// Server file | |
class PushNotifications { | |
// (Android)API access key from Google API's Console. | |
private static $API_ACCESS_KEY = 'AIzaSyDG3fYAj1uW7VB-wejaMJyJXiO5JagAsYI'; | |
// (iOS) Private key's passphrase. | |
private static $passphrase = 'joashp'; | |
// (Windows Phone 8) The name of our push channel. | |
private static $channelName = "joashp"; |