Useful commands (all auth should be md5)
sudo apt install postgresql
sudo vi /etc/postgresql/10/main/pg_hba.conf
sudo systemctl restart postgresql
<?php | |
require('wp-config.php' ); | |
require('wp-includes/pluggable.php' ); | |
$hash = wp_hash_password( "donkey" ); | |
print($hash); | |
?> | |
// https://stackoverflow.com/questions/21485545/is-there-a-way-to-tell-if-an-es6-promise-is-fulfilled-rejected-resolved | |
function MakeQuerablePromise(promise) { | |
// Don't create a wrapper for promises that can already be queried. | |
if (promise.isResolved) return promise; | |
var isResolved = false; | |
var isRejected = false; | |
// Observe the promise, saving the fulfillment in a closure scope. | |
var result = promise.then( |
const yup = require('yup') | |
class SuggestedReviewersValidator { | |
constructor() { | |
this.schema1 = yup.object({ | |
name: yup.string().required(), | |
email: yup.string().email().required() | |
}) | |
this.schema2 = yup.object({ |
fs = require('fs') | |
/* | |
* Wrap old-style callback with promise explicitly created... | |
*/ | |
const readfolderPromise = (folder) => { | |
if (folder === undefined) { | |
folder = process.cwd() | |
} | |
console.log(folder) |
# Build using latest node v9 | |
FROM node:9 as builder | |
RUN mkdir /build | |
WORKDIR /build | |
COPY package.json ./ | |
COPY yarn.lock ./ | |
COPY client client |
#!/usr/bin/env bash | |
# | |
# Usage: pass in the host or host:port as the first argument | |
# | |
# This will then wait for a max of 5 mins for the application to start | |
# | |
RESOURCE=http://$1/assets/app.js | |
CMD="timeout 1s curl -s ${RESOURCE}" |
git checkout develop | |
git pull | |
git checkout <my-branch-that-needs-rebasing> | |
git fetch origin | |
git rebase origin/develop | |
git status | |
git push --force |
import { transform, isEqual, isObject } from 'lodash'; | |
/** | |
* Source: https://gist.github.com/Yimiprod/7ee176597fef230d1451#gistcomment-2565071 | |
* Deep diff between two object, using lodash | |
* @param {Object} object Object compared | |
* @param {Object} base Object to compare with | |
* @return {Object} Return a new object who represent the diff | |
*/ | |
function difference(object, base) { |
const log = console; | |
const sleep = async ms => { | |
return new Promise(resolve => setTimeout(resolve, ms)); | |
}; | |
const asyncFunc1 = async () => { | |
log.log('f1 Start'); | |
await sleep(2000); | |
log.log('f1 End'); |