Snippets Collections
function el(arr) {
  let i = 0;
  return function gen() {
    if (i < arr.length) {
      let val = arr[i];
      i += 1;
      return val;
    }
  }
}
const myArray = [1, 2, 3];
const myGenerator = el(myArray);

console.log(myGenerator()); // 1
console.log(myGenerator()); // 2
console.log(myGenerator()); // 3
console.log(myGenerator()); // undefined
function el(arr) {
  let i = 0;
  return function gen() {
    if (i < arr.length) {
      let val = arr[i];
      i += 1;
      return val;
    }
  }
}
const myArray = [1, 2, 3];
const myGenerator = el(myArray);

console.log(myGenerator()); // 1
console.log(myGenerator()); // 2
console.log(myGenerator()); // 3
console.log(myGenerator()); // undefined
function el(arr) {
  let i = 0;
  return function gen() {
    if (i < arr.length) {
      let val = arr[i];
      i += 1;
      return val;
    }
  }
}
const myArray = [1, 2, 3];
const myGenerator = el(myArray);

console.log(myGenerator()); // 1
console.log(myGenerator()); // 2
console.log(myGenerator()); // 3
console.log(myGenerator()); // undefined
// js
#!/usr/bin/env php
<?php
foreach (glob('*.js') as $js) {
   echo "wp_enqueue_script('wptheme-{$js}', get_template_directory_uri() . '/js/{$js}', array('jquery'), '1.0', true);";
}

// Css
#!/usr/bin/env php
<?php
foreach (glob('*.css') as $css) {
   echo "wp_enqueue_style('wptheme-{$css}', get_template_directory_uri() . '/css/{$css}', null, '1.0');";
}
// js
#!/usr/bin/env php
<?php
foreach (glob('*.js') as $js) {
   echo "wp_enqueue_script('wptheme-{$js}', get_template_directory_uri() . '/js/{$js}', array('jquery'), '1.0', true);";
}

// Css
#!/usr/bin/env php
<?php
foreach (glob('*.css') as $css) {
   echo "wp_enqueue_style('wptheme-{$css}', get_template_directory_uri() . '/css/{$css}', null, '1.0');";
}
star

Sat Oct 21 2023 04:51:13 GMT+0000 (Coordinated Universal Time) video: https://youtu.be/99Zacm7SsWQ?si=DMjv-7OOlInonYd9&t=1398

#javascript #generator #higher-order-function
star

Sat Oct 21 2023 04:50:25 GMT+0000 (Coordinated Universal Time) video: https://youtu.be/99Zacm7SsWQ?si=DMjv-7OOlInonYd9&t=1398

#javascript #generator #higher-order-function
star

Sat Oct 21 2023 04:50:23 GMT+0000 (Coordinated Universal Time) video: https://youtu.be/99Zacm7SsWQ?si=DMjv-7OOlInonYd9&t=1398

#javascript #generator #higher-order-function
star

Sat May 14 2022 10:28:43 GMT+0000 (Coordinated Universal Time)

#generator #css #js
star

Sat May 14 2022 10:28:41 GMT+0000 (Coordinated Universal Time)

#generator #css #js

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension