Skip to content

Instantly share code, notes, and snippets.

@codebubb
codebubb / react-youtube-02-App.js
Created October 14, 2020 13:52
React YouTube Viewer
import React, { useState, useEffect } from 'react';
export function App() {
return (
<div className="app-container">
<h1>Latest YouTube Videos</h1>
</div>
);
}
@codebubb
codebubb / react-youtube-01-index.js
Created October 14, 2020 13:45
React YouTube Viewer
require('file-loader?name=[name].[ext]!./index.html');
import React from 'react';
import ReactDOM from 'react-dom';
import { App } from './App';
import './App.scss';
const appElement = document.getElementById('app');
ReactDOM.render(<App />, appElement);
@codebubb
codebubb / regex_exercises_02.js
Last active June 22, 2023 13:15
Some more Regex strings for testing
const ex1 = 'Grade 1Grade 2Grade 3Grade 4Grade 5';
const ex2 = 'The pheasant has no agenda';
const ex3 = '75, 50 : 123 / 900 - 321 + 900 = 55';
const ex4 = 'My name is: James';
const ex5 = `Did you find any droids? No, sir. If there were any on board, they must also have jettisoned. Send a scanning crew on board. I want every part of this ship checked. Yes, sir. I sense something...a presence I haven't felt since... Get me a scanning crew in here on the double. I want every part of this ship checked! Boy, it's lucky you've these compartments. I use them for smuggling. I never thought I'd be smuggling myself in them. This is ridiculous. Even if I could take off, I'd never get past the tractor beam.`
// Exercise 01
// Using a regex, get an array of the grade values e.g. Grade 1, Grade 2 ...
@codebubb
codebubb / regex_exercises_01.js
Last active April 14, 2023 14:23
Some Regex string testers
const ex1 = 'The quick brown fox jumped over the lazy dog';
const ex2 = 'A1B2C3D4E5F6G7H8I9J10';
const ex3 = 'The salad costs $9.99';
const ex4 = 'Contact customer support on 0800 300 500';
const ex5 = 'You can contact me on Twitter @codebubb or [email protected]';
// Exercise 01
// Using a regex pattern, get the 3 letter words in the ex1 string.
@codebubb
codebubb / accounts.js
Last active July 29, 2025 20:51
List of user bank accounts for practicing
const accounts = [{
_id: "5e56d5f5c00d45b8f1125ef4",
index: 0,
guid: "955310d3-45df-47e7-bc9c-92504d5e92d2",
isActive: true,
balance: "$3,926",
picture: "http://placehold.it/32x32",
age: 26,
eyeColor: "green",
name: "George Bond",
@codebubb
codebubb / mockusers.js
Last active October 11, 2023 19:04
Mock Users
const users = [{
id: "e0aafb31-8ac6-48d4-99ee-12af8ddcbdae",
email: "[email protected]",
ip_address: "53.215.156.73"
}, {
id: "a7b0221d-5228-4992-a964-b5f3e3d7a022",
email: "[email protected]",
ip_address: "34.81.219.4"
}, {
id: "1019b52c-db9d-45a2-975f-404455925a6a",
@codebubb
codebubb / users_comments.js
Created January 15, 2020 20:14
Array of Users and Comments
const users = [
{ id: '88f24bea-3825-4237-a0d1-efb6b92d37a4', firstName: 'Sam', lastName: 'Hughes' },
{ id: '2a35032d-e02b-4508-b3b5-6393aff75a53', firstName: 'Terri', lastName: 'Bishop' },
{ id: '7f053852-7440-4e44-838c-ddac24611050', firstName: 'Jar', lastName: 'Burke' },
{ id: 'd456e3af-596a-4224-b1dc-dd990a34c9cf', firstName: 'Julio', lastName: 'Miller' },
{ id: '58a1e37b-4b15-47c1-b95b-11fe016f7b64', firstName: 'Chester', lastName: 'Flores' },
{ id: 'b4a306cb-8b95-4f85-b9f8-434dbe010985', firstName: 'Madison', lastName: 'Marshall' },
{ id: '6ee904be-e3b0-41c9-b7a2-5a0233c38e4c', firstName: 'Ava', lastName: 'Pena' },
{ id: '7f0ce45a-bdca-4067-968b-d908e79276ce', firstName: 'Gabriella', lastName: 'Steward' },
{ id: '9e525c2d-6fcd-4d88-9ac4-a44eaf3a43e6', firstName: 'Charles', lastName: 'Campbell' },
@codebubb
codebubb / orders.js
Created January 15, 2020 13:29
Array of Orders
const orders = [
{ orderId: '123', customerId: '123', deliveryDate: '01-01-2020', delivered: true, items: [
{ productId: '123', price: 55 },
{ productId: '234', price: 30 },
]},
{ orderId: '234', customerId: '234', deliveryDate: '01-02-2020', delivered: false, items: [
{ productId: '234', price: 30 },
]},
{ orderId: '345', customerId: '234', deliveryDate: '05-01-2020', delivered: true, items: [
{ productId: '567', price: 30 },
@codebubb
codebubb / people.js
Last active July 29, 2024 06:02
Array of People
const people = [
{ firstName: 'Sam', lastName: 'Hughes', DOB: '07/07/1978', department: 'Development', salary: '45000' },
{ firstName: 'Terri', lastName: 'Bishop', DOB: '02/04/1989', department: 'Development', salary: '35000' },
{ firstName: 'Jar', lastName: 'Burke', DOB: '11/01/1985', department: 'Marketing', salary: '38000' },
{ firstName: 'Julio', lastName: 'Miller', DOB: '12/07/1991', department: 'Sales', salary: '40000' },
{ firstName: 'Chester', lastName: 'Flores', DOB: '03/15/1988', department: 'Development', salary: '41000' },
{ firstName: 'Madison', lastName: 'Marshall', DOB: '09/22/1980', department: 'Sales', salary: '32000' },
{ firstName: 'Ava', lastName: 'Pena', DOB: '11/02/1986', department: 'Development', salary: '38000' },
{ firstName: 'Gabriella', lastName: 'Steward', DOB: '08/26/1994', department: 'Marketing', salary: '46000' },
{ firstName: 'Charles', lastName: 'Campbell', DOB: '09/04/1977', department: 'Sales', salary: '42000' },
@codebubb
codebubb / proxy-example.js
Last active December 16, 2019 14:27
Proxy Example
const userProxy = {
get: function (target, name) {
return name === 'password' ? '*'.repeat(target.password.length) : target[name];
}
}
// or shorter
const userProxy = {
get: (target, name) => name === 'password' ? '*'.repeat(target.password.length) : target[name],