Skip to content

Instantly share code, notes, and snippets.

View ohhskar's full-sized avatar

Oscar Vian Valles ohhskar

  • Cebu City, Cebu, Philippines
View GitHub Profile
@ohhskar
ohhskar / flatChild.js
Created April 16, 2020 15:23
Flatten the children of two or more NodeLists into an array
// Magic code to flatten the children of two or more nodelists.
// [...sides] converts the two nodelists into two arrays. this is then
// mapped to get the children. [...element.children] gets the children of each
// side, but in the form of an array. This is done so that there will be n arrays
// that is composed of the children, this is then flattened
const getChildren = (sides) => [...sides].map((element) => [...element.children]).flat();
@ohhskar
ohhskar / notifcations.sh
Last active September 19, 2021 14:02
Spotifyd Notification using Playerctl and notify-send.sh
#!/bin/bash
if [ "$PLAYER_EVENT" = "start" ] || [ "$PLAYER_EVENT" = "change" ];
then
trackName=$(playerctl metadata title)
artistAndAlbumName=$(playerctl metadata --format "{{ artist }} ({{ album }})")
notify-send -u low "$trackName" "$artistAndAlbumName "
fi