Definitely not comprehensive. This is meant to be a basic memory aid with links to get more details. I'll add to it over time.
$ npm install mongoose --save
const mongoose = require('mongoose');
It's been often said that programming is part art, part science - that because lots of times there's no single, simple solution to a problem; or if there is, we might not know about it. There's also an infamous joke that if there are n developers in the room, then there are n+1 opinions on how things should be done. That being said, here are some guidelines that should prevent friction when submitting or reviewing code.
The code has to work. Unless you open a PR as a work in progress, the code should be built and tested on a device or emulator.
If you have touched the gradle build files and changed build setup, it's useful to test the whole build from scratch (clean build) and all of the types and flavours. If you have touched payments (logic or UI), you should test that it still works correctly, both in test and production builds. If you updated external libraries, test the pertaining features (e.g. if you
It's been often said that programming is part art, part science - that because lots of times there's no single, simple solution to a problem; or if there is, we might not know about it. There's also an infamous joke that if there are n developers in the room, then there are n+1 opinions on how things should be done. That being said, here are some guidelines that should prevent friction when submitting or reviewing code.
The code has to work. Unless you open a PR as a work in progress, the code should be built and tested on a device or emulator.
If you have touched the gradle build files and changed build setup, it's useful to test the whole build from scratch (clean build) and all of the types and flavours. If you have touched payments (logic or UI), you should test that it still works correctly, both in test and production builds. If you updated external libraries, test the pertaining features (e.g. if you
const crypto = require("crypto") | |
// The `generateKeyPairSync` method accepts two arguments: | |
// 1. The type ok keys we want, which in this case is "rsa" | |
// 2. An object with the properties of the key | |
const { publicKey, privateKey } = crypto.generateKeyPairSync("rsa", { | |
// The standard secure default length for RSA keys is 2048 bits | |
modulusLength: 2048, | |
}) |
#!/bin/bash | |
# | |
# Public-Key Encryption and Decryption | |
# * http://www.openssl.org/ | |
# * http://barelyenough.org/blog/2008/04/fun-with-public-keys/ | |
# | |
# Mac OS X 10.6.4 | |
# OpenSSL 0.9.8l 5 Nov 2009 | |
# Generate keys |
// This gist is for my YouTube video which I tried to explain Window Sliding Technique. | |
// You can watch it from here: https://youtu.be/guDU5HnLqAs | |
// Given a sorted array A (sorted in ascending order), having N integers, | |
// find if there exists any pair of elements (A[i], A[j]) such that | |
// their sum is equal to X. | |
// | |
// Input: A = [2,3,4,5,6,7,8,9], k= 10 | |
// Output: true | |
// NOTE: We slightly changed the question and the output in the video. We're returning pair indexes as an array. |
//package.json | |
{ | |
... | |
"devDependencies": { | |
... | |
"purgecss": "^3.0.0" | |
}, | |
"scripts": { | |
"start": "react-scripts start", | |
"build": "react-scripts build && npm run purge-css", |
from https://stackoverflow.com/questions/25774999/nginx-stat-failed-13-permission-denied
Nginx operates within the directory, so if you can't cd
to that directory from the nginx user then it will fail (as does the stat
command in your log). Make sure the www-user
can cd
all the way to the /username/test/static
. You can confirm that the stat will fail or succeed by running
sudo -u www-data stat /username/test/static
var accounts = [ | |
{ name: 'James Brown', msgCount: 123 }, | |
{ name: 'Stevie Wonder', msgCount: 22 }, | |
{ name: 'Sly Stone', msgCount: 16 }, | |
{ name: 'Otis Redding', msgCount: 300 } // Otis has the most messages | |
]; | |
// get sum of msgCount prop across all objects in array | |
var msgTotal = accounts.reduce(function(prev, cur) { | |
return prev + cur.msgCount; |
//here is document with NESTED Array | |
{ | |
"_id": "xyz-800", | |
"site": "xyz", | |
"user": 800, | |
"timepoints": [ | |
{"timepoint": 0, "a": 1500, "b": 700}, | |
{"timepoint": 2, "a": 1000, "b": 200}, | |
{"timepoint": 4, "a": 3500, "b": 1500} | |
] |