Project: codever - File: searchbar.component.ts

Here used the success method with IziToastSettings

import iziToast, { IziToastSettings } from 'izitoast';

removeSearch(search: Search, e: MouseEvent) {
  e.preventDefault();
  e.stopPropagation();

  const indexSavedSearch = this.getIndexSavedSearch(search.searchDomain, search.text);

  const deletedSearch = this._userData.searches.splice(indexSavedSearch, 1)[0];
  this.userDataStore.updateUserData$(this._userData).subscribe(() => {
    console.log('Removed search ' + search.text + ' from domain ' + search.searchDomain);
    const iziToastSettings: IziToastSettings = {
      title: `"${deletedSearch.text}" deleted from "${deletedSearch.searchDomain}" search history `,
      timeout: 3000,
      position: 'bottomRight'
    }
    iziToast.success(iziToastSettings);
  });
}


Reference - https://izitoast.marcelodolza.com/#Methods


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

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.land. Use the Copy to mine functionality to copy this snippet to your own personal collection and easy manage your code snippets.

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.land. Use the Copy to mine functionality to copy this snippet to your own personal collection and easy manage your code snippets.

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.land/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.land. Use the Copy to mine functionality to copy this snippet to your own personal collection and easy manage your code snippets.

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.land. Use the Copy to mine functionality to copy this snippet to your own personal collection and easy manage your code snippets.