Skip to content

Instantly share code, notes, and snippets.

@codebubb
codebubb / functions.js
Created November 1, 2023 16:52
6 Ways To Write Functions in JavaScript
/*
1. With a Function declaration
Function is hoisted so can be used before it is declared
*/
console.log(add(2, 2));
function add(n1, n2) {
return n1 + n2;
}
@codebubb
codebubb / random-number.html
Last active November 1, 2023 14:23
Random number generator in JavaScript
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>JSON.parse Error</title>
<style>
* {
box-sizing: border-box;
@codebubb
codebubb / index.html
Created November 1, 2023 10:21
How To Fix the JSON parse error
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>JSON.parse Error</title>
<style>
* {
box-sizing: border-box;
@codebubb
codebubb / js-exercises-02.md
Created October 23, 2023 10:15
JavaScript Exercise 02: Valid Zip Codes

JavaScript Exercises: Exercise 02

Valid Zip Codes

Write some code that validates a Zip code.

The rules for a valid zip code are as follows:

  • Contain only numeric values (no non-digits allowed).
  • Has no spaces
@codebubb
codebubb / js-exercises-01.md
Last active October 23, 2023 08:18
JavaScript Exercises: Exercise 01

JavaScript Exercises: Exercise 01

Scrabble Score

Scrabble is a word game where players score points for making words on a tiled board.

The amount a player scores for a word depends on what letters they use in their word.

Your goal for this exercise is to work out the Scrabble score for a player's word.

@codebubb
codebubb / fixed-header-footer.css
Created October 12, 2023 18:52
Fixed header footer
@codebubb
codebubb / workspace.json
Created December 7, 2021 09:44
Example workspace.json
{
"version": 2,
"projects": {
"rickandroll": {
"root": "apps/rickandroll",
"sourceRoot": "apps/rickandroll/src",
"projectType": "application",
"targets": {
"build": {
"executor": "@nrwl/node:build",
@codebubb
codebubb / nginx.example
Created December 4, 2021 10:04
nginx Example Server Config
server {
listen 80;
listen [::]:80;
root /var/www/{domain}/html;
index index.html index.htm index.nginx-debian.html;
server_name {domain} www.{domain};
location /api/ {
@codebubb
codebubb / react-youtube-08-App.js
Created November 5, 2020 21:05
React YouTube Viewer
import React, { useState, useEffect } from 'react';
import { Search } from './Search';
import { Video } from './Video';
export function App() {
const [videos, setVideos] = useState([]);
const [currentChannelId, setCurrentChannelId] = useState();
const [channelName, setChannelName] = useState();
const [searchError, setSearchError] = useState(); // Create searchError state
@codebubb
codebubb / react-youtube-07-App.scss
Created November 5, 2020 20:56
React YouTube Viewer
body {
font-family: "Commissioner", sans-serif;
font: "Commissioner", sans-serif;
}
.app-container {
padding: 50px;
}
.search {