Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

2-proj#46

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
imrozkhan205 wants to merge1 commit intosahandghavidel:main
base:main
Choose a base branch
Loading
fromimrozkhan205:2-proj
Open
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file addedprojects/dice-roller/dice_images/Dice-1.png
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletionsprojects/dice-roller/index.html
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="styles.css" >

<title>Document</title>
</head>
<body>
<div id="container" >
<h1>Dice Roller </h1>
<label># of dice:</label>
<input type="number" id="numOfDice" value="1" min="1">
<button onclick="rollDice()" >Roll Dice</button>
<div id="diceResult"></div>
<div id="diceImages"></div>
</div>
<script src="script.js" ></script>
</body>
</html>
16 changes: 16 additions & 0 deletionsprojects/dice-roller/script.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
function rollDice(){
const numOfDice = document.getElementById("numOfDice").value;
const diceResult = document.getElementById("diceResult");
const diceImages = document.getElementById("diceImages");
const values = [];
const images = [];

for(let i = 0;i < numOfDice;i++){
const value = Math.floor(Math.random()*6)+1;
values.push(value);
images.push(`<img src="dice-images/${value}.png">`);
}

diceResult.textContent = `dice: ${values.join(', ')}`;
diceImages.innerHTML = images.join('');
}
30 changes: 30 additions & 0 deletionsprojects/dice-roller/styles.css
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
#container{
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
text-align: center;
font-size: 2rem;
font-weight: bold;

}
button{
font-size: 1.5rem;
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
padding: 10px 15px;
border-radius: 10px;
border: none;
color: rgb(37, 37, 37);
font-weight:500;
cursor: pointer;
background: linear-gradient(to left bottom, lightgreen, lightblue);
}
button:hover{
background:linear-gradient(to left bottom, rgb(104, 246, 104), rgb(139, 223, 250));
}
button:active{
background:linear-gradient(to left bottom, rgb(158, 235, 158), rgb(179, 224, 240));
}
input{
font-size: 2rem;
width: 150px;
text-align: center;
font-weight: bold;
}
13 changes: 13 additions & 0 deletionsrandom-password-generator/index.html
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="styles.css" >
<script src="script.js" ></script>
</head>
<body>

</body>
</html>
39 changes: 39 additions & 0 deletionsrandom-password-generator/script.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
function generatePassword(length, includeLowercase, includeNumbers, includeSymbols, includeUppercase){
const lowercaseChars = "abscdefghijklopqrstuvwxyz";
const uppercaseChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
const numberChars = "0123456789"
const symbolChars = "@._&";
let allowedChars = " ";
let password = "";
allowedChars += includeLowercase ? lowercaseChars: "";
allowedChars += includeUppercase ? uppercaseChars: "";
allowedChars += includeNumbers ? numberChars:"";
allowedChars += includeSymbols ? symbolChars:"";
console.log(allowedChars);
if(length <= 0){
return `(password length must be at least 1)`;
}
if(allowedChars.length === 0){
return `(At least 1 char needs to be selected)`
}
for(let i = 0; i<length; i++){
const randomIndex = Math.floor(Math.random() * allowedChars.length);
password += allowedChars[randomIndex];
}

return password;
}


const passwordLength = 12;
const includeLowercase = true;
const includeUppercase = true;
const includeNumbers = true;
const includeSymbols = true;

const password = generatePassword(passwordLength, includeLowercase,
includeNumbers,
includeUppercase,
includeSymbols);

console.log(`Generated Password:${password}`);
View file
Open in desktop
Empty file.

[8]ページ先頭

©2009-2025 Movatter.jp