Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Event listener on a CSS pseudo-elemen</title>
<style>
#box {
position: relative;
height: 300px;
@jabed-web-dev
jabed-web-dev / JavaScript Prototypes and Inheritance.js
Last active October 21, 2023 03:31
Understanding Prototypes and Inheritance in JavaScript
{
// Initialize constructor functions Constructor/Prototype
function Person(firstName, lastName) {
this.firstName = firstName
this.lastName = lastName
}
Person.prototype.getFullName = function () {
return this.firstName + ' ' + this.lastName
}
import { useState } from 'react'
export default function ReactApp() {
const [count, setCount] = useState(0)
function handleClick() {
setCount(count + 1)
}
return <button onClick={handleClick}>Clicked {`${count}`} times</button>
@jabed-web-dev
jabed-web-dev / blazorserver-console.log.razor
Created November 14, 2022 15:24
blazor server log to browser console
<h1>Counter</h1>
<p role="status">Current count: @currentCount</p>
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
@code {
[Inject]
public IJSRuntime JSRuntime { get; set; } = null!;
public async void ConsoleLog(int arg)
@jabed-web-dev
jabed-web-dev / color-scheme.js
Last active December 2, 2023 09:31
color-scheme and media-screen
window.addEventListener('load', () => {
const html = document.documentElement,
button = document.createElement('button'),
light = '🔆',
dark = '🌙';
let styles = {
position: 'absolute',
top: '2px',
right: '2px',
@jabed-web-dev
jabed-web-dev / preview.html
Created November 9, 2022 07:20
resize iframe and change color scheme
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Preview</title>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<style>
@jabed-web-dev
jabed-web-dev / postMessage.js
Created November 9, 2022 06:41
Handle the post message inside the frame window
// Handle the post message inside the frame window
// index.html
frame.onload = () => {
setTimeout(() => {
window.frames.frame.postMessage("hello Frame", "*");
}, 5000)
}
// Handle the message from the parent window
@jabed-web-dev
jabed-web-dev / set-exe-icon.cmd
Last active November 2, 2022 10:50
set icon in c/c++ exe file
echo 'MAIN ICON "favicon.ico"' > resources.rc
g++.exe -Wall -fexceptions -g -c app.cpp -o app.o
windres.exe -J rc -O coff -i RESOUR~1.RC -o resources.res
g++.exe -o app.exe app.o resources.res
@jabed-web-dev
jabed-web-dev / nodejs-pause.js
Created November 2, 2022 09:45
pause nodejs console
process.stdout.write('\n\x1b[0;32mPress any key to continue . . . \x1b[0m');
process.stdin.setRawMode(true);
process.stdin.resume();
process.stdin.on('data', process.exit.bind(process, 0));
@jabed-web-dev
jabed-web-dev / git.md
Last active January 7, 2023 10:32
Git Reference Manual

 Git Complete list of all commands

 Setup and Config

--local | --global | --system
    [user|author].name <name>
    [user|author].email <email>
    init.defaultBranch <name>