Get current day with LocalDateTime.now() from which you can substract years, weeks, days up to nanos (in the shown example days with minusDays(long days)):

LocalDateTime dateToLookBack = LocalDateTime.now().minusDays(30);

You can achieve the same result by using the minus(TemporalAmount amountToSubtract) method as below

final var dateToLookBackTo = LocalDateTime.now().minus(Duration.ofDays(30));

Reference - https://docs.oracle.com/javase/8/docs/api/java/time/LocalDateTime.html


Shared with from Codever. 👉 Use the Copy to mine functionality to copy this snippet to your own personal collection and easy manage your code snippets.

Codever is open source on Github ⭐🙏

Use diplay:flex on both wrapper div and ul element and set margin-right and margin-left to auto at the list level:

.identity-providers-list {
  display: flex;
  ul {
    margin-left: auto;
    margin-right: auto;
    display: flex;
    list-style: none;
    li {
      margin-right: 2rem;
    }
  }
}

Usage example

  <div class="identity-providers-list">
    <ul>
      <li>
        <i class="fab fa-github"></i> Github
      </li>
      <li>
        <i class="fab fa-google"></i> Google
      </li>
      <li>
        <i class="fab fa-gitlab"></i> Gitlab
      </li>
      <li>
        <i class="fab fa-stack-overflow"></i> StackOverflow
      </li>
    </ul>
  </div>

You can see how it looks in the register page on Codever


Shared with from Codever. 👉 Use the Copy to mine functionality to copy this snippet to your own personal collection and easy manage your code snippets.

Codever is open source on Github ⭐🙏

Use vscode.window.showInputBox - the returned value will be undefined if the input box was canceled (e.g. pressing ESC). Otherwise the returned value will be the string typed by the user or an empty string if the user did not type anything but dismissed the input box with OK.

const searchQuery = await vscode.window.showInputBox({
  placeHolder: "Search query",
  prompt: "Search my snippets on Codever",
  value: selectedText
});
if(searchQuery === ''){
  console.log(searchQuery);
  vscode.window.showErrorMessage('A search query is mandatory to execute this action');
}

if(searchQuery !== undefined){
  const searchUrl = `https://www.codever.dev/search?q=${searchQuery}&sd=my-snippets`;
  vscode.env.openExternal(Uri.parse(searchUrl));
}

Reference - https://code.visualstudio.com/api/references/vscode-api#window.showInputBox

You can see it in action in the following demo:

Search from Codever Snippets VSCode Extension Demo
Search from Codever Snippets VSCode Extension Demo

Shared with from Codever. 👉 Use the Copy to mine functionality to copy this snippet to your own personal collection and easy manage your code snippets.

Codever is open source on Github ⭐🙏

Use update method with the multi flag set to true

db.users.update(
  { "welcomeAck": { "$exists": false } },
  { "$set": { "welcomeAck": true } },
  { "multi": true }
);

Or the equivalent shortcut with updateMany:

db.users.updateMany(
  { "welcomeAck": { "$exists": false } },
  { "$set": { "welcomeAck": true } }
);

Reference - https://docs.mongodb.com/manual/tutorial/update-documents/


Shared with from Codever. 👉 Use the Copy to mine functionality to copy this snippet to your own personal collection and easy manage your code snippets.

Codever is open source on Github ⭐🙏

To list services, pods and deployments resources from kubernetes namespace use the kubectl get command with --namespace=my-namespace (short -n)

# Set the "current" namespace for context
kubectl config set-context --current --namespace=my-namespace

# Get commands with basic output
kubectl get services                          # List all services in the namespace
kubectl get pods --all-namespaces             # List all pods in all namespaces
kubectl get pods -o wide                      # List all pods in the current namespace, with more details
kubectl get deployment my-dep                 # List a particular deployment
kubectl get pods                              # List all pods in the namespace
kubectl get pods  -n my-namespace             # List all pods in the "my-namespace" namespace (in namespace not set)
kubectl get pod my-pod -o yaml                # Get a pod's YAML

Reference - https://kubernetes.io/docs/reference/kubectl/cheatsheet/


Shared with from Codever. 👉 Use the Copy to mine functionality to copy this snippet to your own personal collection and easy manage your code snippets.

Codever is open source on Github ⭐🙏