Use the page.categories variable and select index 0 of the array:


  {% if page.categories[0] != "snippets" %}
    {% include promote-bookmarks.dev.html %}
  {% endif %}

Reference - https://jekyllrb.com/docs/variables/


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 ⭐🙏

Convert the array into String using Collectors.joining() method of the stream package:

import java.util.stream.Collectors;
import java.util.stream.Stream;

class GenerateStringFromArray {
  public static void main(String[] args) {

    String[] values = {"Bookmarks.dev -", "Bookmarks", "and", "code snippets", "manager"};

    String text = Stream.of(values)
        .map(Object::toString) // in this case you can remove the map, but useful for complexer objects
        .collect(Collectors.joining(" "));

    System.out.println(text);
  }
}

Result

"Bookmarks.dev - Bookmarks and code snippets manager"

Reference - https://docs.oracle.com/javase/8/docs/api/java/util/stream/Collectors.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 a global replace with \W+ option ( \W+ means any sequence of non-word characters)


    private generateDashBasedUrlPathFromTitle(title: string) {
        return title.trim().replace(/\W+/g, '-').toLowerCase();
    }

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 ⭐🙏

The following expression returns the Unix time in milliseconds independent of the time zone.

It sums the number of days passed from the start of the Unix epoch multiplied by the number of milliseconds in a day (24 * 60 * 60 * 1000 = 86400000) plus number of milliseconds past midnight (SSSSS with a precision of 3 FF3 to express milliseconds).

It uses the SYS_EXTRACT_UTC method to extract the UTC (Coordinated Universal Time—formerly Greenwich Mean Time) from the current timestamp (systimestamp in oracle):

SELECT
     EXTRACT(DAY FROM(sys_extract_utc(systimestamp) - to_timestamp('1970-01-01', 'YYYY-MM-DD'))) * 86400000
    + to_number(TO_CHAR(sys_extract_utc(systimestamp), 'SSSSSFF3'))
  FROM dual;

Reference - https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/SYS_EXTRACT_UTC.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 ⭐🙏

Project: codever - File: snippet-form.base.component.ts

In the router.navigate method place the object /data in the state field of the navigation extras parameter

//  constructor( protected router: Router) {}

  navigateToSnippetDetails(snippet: Codelet, queryParams: Params): void {
    const link = [`./my-snippets/${snippet._id}/details`];
    this.router.navigate(link, {
      state: {snippet: snippet},
      queryParams: queryParams
    });
  }

To receive on the the other end of the line, just look for it in window.history.state

  ngOnInit(): void {
    this.popup = this.route.snapshot.queryParamMap.get('popup');
    this.snippet$ = of(window.history.state.snippet);
    if (!window.history.state.snippet) {
      this.userInfoStore.getUserInfo$().subscribe(userInfo => {
        this.userId = userInfo.sub;
        this.codeletId = this.route.snapshot.paramMap.get('id');
        this.snippet$ = this.personalCodeletsService.getPersonalCodeletById(this.userId, this.codeletId);
      });
    }
  }

Reference - https://angular.io/api/router/NavigationExtras


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 ⭐🙏