Fire action after enqueue script

I have a color switcher but its css files load before default css files.so, it doesn’t work good.I want to fire it after enqueue script.after all css and js files on the website, I want to load my color switcher css file.

it adds:

<link rel="stylesheet" id="colors" href=link.com/colors/color-2.css" type="text/css"> 

with some functions like that:

jQuery(document).ready(function($  ) {     $  ("ul.colors .color1").click(function () {         $  ("#colors").attr("href", "<?php echo esc_url ( plugin_dir_url( __FILE__ ) . '/css/colors/default.css'); ?>");         return false;     }) }); 

I want to add id="colors"after all css and js files.

Conditionally enqueue a stylesheet based off of a javascript click event

I would like to use a different ccs file based on a javascript click event. The user will have a choice of color themes by clicking one of the colored buttons on the screen. I originally have it working by providing the linked css with an id that can be targeted with javascript. The link is in the HTML head tag of course. In WordPress though we enqueue the css file in the functions.php file and so I am not sure how to give the css file an ID to target it with the javascript. If anyone can help me out or point me in the right direction I will really appreciate it. I am open to all possibilities and I thank you all in advance. if you need me to elaborate more feel free to let me know.

Enqueue script globally

This only works for admin dashboard.

add_action('admin_enqueue_scripts',array($  this, 'login_register96_adminscripts')); 

And this only works for the user place.

add_action( 'wp_enqueue_scripts', array($  this , 'login_register96_scripts') ); 

Is there a way I can enqueue a script globally? Which will be operational on the whole website including admin dashboard.

Incorporate a background job enqueue endpoint in a REST API

To exchange data between our standalone frontend application and the backend API, we currently have a REST API, with standard endpoint to list/create/update/destroy ressources with a consistent naming and appropriate routes e.g for users:

GET /api/v1/users: list all users GET /api/v1/users/{id}: return a specific user POST /api/v1/users: create a user PATCH /api/v1/users/{id}: update a user DELETE /api/v1/users/{id}: destroy a user 

However, our platform being a data processing tool, users can choose to start a task applying a certain operation to their data. The frontend will send a request to the backend in order to trigger the background job.

How should this fit in a REST API ? A background task is not a ressource as users or companies can be. I have trouble finding a way to design a good API around launching background tasks or triggering events/messages that are not considered ressources.

How would you approach this ?

What is the time complexity of enqueue and dequeue of a queue implemented with a singly linked list?

I’m trying to understand the time complexity of a queue implemented with a linked list data structure. My book says that we can the implement a queue in O(1) time by:

  • enqueueing at the back
  • dequeueing at the head

and it also says

Note that although adding an element to the tail is constant time, removing an element from the tail is O(n) as we have to find the new tailenter code here

I know that adding a new node to my queue at the head (enqueue) takes O(1) since I have the head pointer. Similarly, removing a node at the head (dequeue) will take O(1) as well. But I don’t understand why adding an element at the back (enqueue) takes O(1), while removing it (dequeue) takes O(n). It would make more sense to me if enqueueing at the back took O(n) rather than O(1), since in both cases (adding/removing at the back) would need to find the tail pointer and therefore it would need to traverse the entire list.