Skip to content

Instantly share code, notes, and snippets.

@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 / 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 james@juniordevelopercentral.com';
// Exercise 01
// Using a regex pattern, get the 3 letter words in the ex1 string.
@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 / 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 / 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-03-Search.js
Created October 14, 2020 14:06
React YouTube Viewer
import React, { useState } from 'react';
export const Search = props => {
const [channelId, setChannelId] = useState('');
return (
<div>
<div className="search">
<input type="text" onChange={event => setChannelId(event.target.value)} placeholder="Enter your favourite channel ID" />
<button disabled={!channelId.length} onClick={() => props.setCurrentChannelId(channelId)}>Get videos</button>
</div>
@codebubb
codebubb / react-youtube-04-App.js
Last active October 14, 2020 14:22
React YouTube Viewer
import React, { useState, useEffect } from 'react';
import { Search } from './Search';
export function App() {
const [currentChannelId, setCurrentChannelId] = useState();
return (
<div className="app-container">
<h1>Latest YouTube Videos</h1>
<Search setCurrentChannelId={id => setCurrentChannelId(id)}/>
@codebubb
codebubb / react-youtube-05-Video.js
Created October 14, 2020 14:29
React YouTube Viewer
import React from 'react';
export const Video = props => (
<div className="videos__item">
<div className="video__image">
<a target="_blank" href={props.video.link}>
<img src={`https://i4.ytimg.com/vi/${props.video.guid.split(':')[2]}/mqdefault.jpg`} />
</a>
</div>
<div className="video__footer">
@codebubb
codebubb / react-youtube-06-App.js
Last active November 6, 2020 11:06
React YouTube Viewer
import React, { useState, useEffect } from 'react';
import { Search } from './Search';
import { Video } from './Video';
export function App() {
const [currentChannelId, setCurrentChannelId] = useState();
const [videos, setVideos] = useState([]);
const baseUrl = 'https://api.rss2json.com/v1/api.json?rss_url=https%3A%2F%2Fwww.youtube.com%2Ffeeds%2Fvideos.xml%3Fchannel_id%3D';
@codebubb
codebubb / index.html
Last active October 16, 2020 11:47
Parcel JS index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ParcelJS</title>
<link rel="stylesheet" href="scss/styles.scss">
</head>
<body>
<h1>Hello from Parcel!</h1>