Monday, 11 December 2023
PHP Unit test cheat sheet
Friday, 1 December 2023
Tuesday, 28 November 2023
Revisit "How to make the entire page fade in on load" using Vue.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>Body Fade In</title>
<link rel="stylesheet" href="./style.css" />
</head>
<body>
<transition name="fade" appear>
<h1>Hello World!</h1>
</transition>
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
<script src="./app.js"></script>
</body>
</html>
style.css
.fade-enter-active,
.fade-leave-active {
transition: opacity 1s;
}
.fade-enter-from,
.fade-leave-to {
opacity: 0;
}
app.js
const app = Vue.createApp({});
app.mount("body");
Revisit "Simple tab navigation using jQuery" using Vue.js
Thursday, 23 November 2023
Node Package Manager (NPM) Cheat Sheet
Node.js cheat sheet
Object-Oriented Programming (OOP) cheat sheet
New stuff on the EWD website
Today, I added some content to the Effective Web Designs (EWD) website.
I created it as a Laravel site.
The site has a simple search form.
It pulls content from this blog using the Blogger API.
It makes suggestions through the blog entry title for the next step, and allows the user to select one of those titles.
Once a title has been selected, it is used to provide results from the Brave search API.
The results are also links.
See the code for this site on GitHub.
Vue.js cheat sheet
VS Code cheat sheet
User eXperience (UX) cheat sheet
User Interface (UI) cheat sheet
Tailwind CSS cheat sheet
Secure Socket Layer (SSL) cheat sheet
Search Engine Optimization (SEO) cheat sheet
Software Development Life Cycle (SDLC) cheat sheet
jQuery cheat sheet
Design Patterns cheat sheet
Tuesday, 18 April 2023
JavaScript fetch, VS Code, CORS, Debugging and curl
I've recently been trying to use the Pocket API to bring my favourite links into a page. Naturally, I was starting from a position of testing it on localhost. I've also been using VS Codium, which has improved on Ubuntu. I use the Brave browser and so was looking to make use of this in my debugging.
So first things, first I needed to get debugging happening in VS Codium using Brave on Ubuntu. As you try and run the debugger, you have the option to create a launch.json file for your project. Here, I selected to create a Chrome web app. Once the launch.json was created, I edited it with the following, in order that the debugger used Brave:
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Brave",
"runtimeExecutable": "/opt/brave.com/brave/brave-browser",
"userDataDir": true,
"url": "http://localhost:5500",
"webRoot": "${workspaceFolder}",
"runtimeArgs": ["--disable-web-security"]
}
]
}
I the setting "--disable-web-security" fixed the CORS problem commonly faced such as,
Access to fetch at ‘http://localhost:8000/api/v1/messages’ from origin ‘http://localhost:8080’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.
The final issue I encountered was the code itself. I'd successfully retrieved the data I was looking for using curl, but converting the curl command to a JavaScript fetch was problematic. I then came across this page which helped.
Now we're cooking!