Skip to content

Commit

Permalink
Merge branch 'master' into football
Browse files Browse the repository at this point in the history
  • Loading branch information
Yashgabani845 committed Jun 2, 2024
2 parents a2cc490 + 7c4932a commit a044d64
Show file tree
Hide file tree
Showing 106 changed files with 19,311 additions and 1 deletion.
83 changes: 83 additions & 0 deletions Existing_API_Collection/Bored-API/Bored API/Activities.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
[
{
"id": 1,
"activity": "Read a book"
},
{
"id": 2,
"activity": "Go for a walk in the park"
},
{
"id": 3,
"activity": "Try a new recipe"
},
{
"id": 4,
"activity": "Learn a new language"
},
{
"id": 5,
"activity": "Practice meditation or yoga"
},
{
"id": 6,
"activity": "Write in a journal"
},
{
"id": 7,
"activity": "Watch a documentary"
},
{
"id": 8,
"activity": "Take up gardening"
},
{
"id": 9,
"activity": "Try a new hobby like painting or knitting"
},
{
"id": 10,
"activity": "Visit a museum or art gallery"
},
{
"id": 11,
"activity": "Volunteer for a local charity"
},
{
"id": 12,
"activity": "Listen to a podcast"
},
{
"id": 13,
"activity": "Have a picnic in the backyard"
},
{
"id": 14,
"activity": "Explore a nearby town or city"
},
{
"id": 15,
"activity": "Take a photography walk"
},
{
"id": 16,
"activity": "Have a board game night with friends or family"
},
{
"id": 17,
"activity": "Try a DIY project"
},
{
"id": 18,
"activity": "Attend a virtual workshop or webinar"
},
{
"id": 19,
"activity": "Organize your living space"
},
{
"id": 20,
"activity": "Plan a future trip or adventure"
}
]

34 changes: 34 additions & 0 deletions Existing_API_Collection/Bored-API/Bored API/server/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const express = require('express');
const axios = require('axios'); // Import Axios

const app = express();
const PORT = process.env.PORT || 3000;

// Serve static files (HTML, CSS, JavaScript)
app.use(express.static('public'));

// Define route to handle the client's request for a random activity
app.get('/randomActivity', async (req, res) => {
try {
const apiUrl = 'https://suyash878.github.io/JSON_boredAPI_Activities/Activities.json';
const response = await axios.get(apiUrl); // Use Axios to make GET request

if (!response.data) {
throw new Error('Empty response from the API');
}

// Pick a random activity from the response data array
const randomIndex = Math.floor(Math.random() * response.data.length);
const randomActivity = response.data[randomIndex].activity;

res.json({activity: randomActivity});
} catch (error) {
console.error('Error fetching activity:', error);
res.status(500).json({ error: 'Failed to fetch activity' });
}
});

// Start the server
app.listen(PORT, () => {
console.log(`Server is running on port ${PORT}`);
});
26 changes: 26 additions & 0 deletions Existing_API_Collection/Cricket_Score_API/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Cricket Score Dashboard

This is a simple web application that displays current cricket matches, live scores, and a list of players using data fetched from cricket APIs.

## Features

- Displays current cricket matches with details like venue and date.
- Shows live scores of ongoing cricket matches.
- Provides a list of cricket players.

## Technologies Used

- HTML
- CSS (Bootstrap)
- JavaScript

## How to Use

1. Clone this repository to your local machine.

```bash
git clone <repository-url>

2. go to folder Cricket_Score_API

3. Run index.html file
60 changes: 60 additions & 0 deletions Existing_API_Collection/Cricket_Score_API/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Cricket Score Dashboard</title>
<!-- Bootstrap CSS -->
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<a class="navbar-brand" href="#">Cricket Score Dashboard</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="#currentMatches">Current Matches</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#liveScores">Live Scores</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#playerList">Player List</a>
</li>
</ul>
</div>
</nav>

<div class="container mt-5">
<div id="currentMatches" class="mt-5">
<h2>Current Matches</h2>
<div id="currentMatchesList" class="row">
<!-- Data will be fetched and displayed here -->
</div>
</div>
<div id="liveScores" class="mt-5">
<h2>Live Scores</h2>
<div id="liveScoresList" class="row">
<!-- Data will be fetched and displayed here -->
</div>
</div>
<div id="playerList" class="mt-5">
<h2>Player List</h2>
<ul id="playerListItems">

</ul>
</div>
</div>


<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.5.4/dist/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<script src="script.js">

</script>
</body>
</html>
71 changes: 71 additions & 0 deletions Existing_API_Collection/Cricket_Score_API/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// Function to fetch current matches
function fetchCurrentMatches() {
fetch('https://api.cricapi.com/v1/currentMatches?apikey=9df522d1-26ac-494c-9085-484911641a9f&offset=0')
.then(response => response.json())
.then(data => {
const currentMatchesList = document.getElementById('currentMatchesList');
currentMatchesList.innerHTML = ''; // Clear previous content
data.data.forEach(match => {
const matchCard = `
<div class="col-md-6 mb-3">
<div class="card">
<div class="card-body">
<h5 class="card-title">${match.name}</h5>
<p class="card-text">Status: ${match.status}</p>
<p class="card-text">Venue: ${match.venue}</p>
<p class="card-text">Date: ${match.date}</p>
</div>
</div>
</div>
`;
currentMatchesList.innerHTML += matchCard;
});
});
}

// Function to fetch live scores
function fetchLiveScores() {
fetch('https://api.cricapi.com/v1/cricScore?apikey=9df522d1-26ac-494c-9085-484911641a9f')
.then(response => response.json())
.then(data => {
const liveScoresList = document.getElementById('liveScoresList');
liveScoresList.innerHTML = ''; // Clear previous content
data.data.forEach(score => {
const scoreCard = `
<div class="col-md-6 mb-3">
<div class="card">
<div class="card-body">
<h5 class="card-title">${score.t1} vs ${score.t2}</h5>
<p class="card-text">Status: ${score.status}</p>
<p class="card-text">Series: ${score.series}</p>
</div>
</div>
</div>
`;
liveScoresList.innerHTML += scoreCard;
});
});
}

// Function to fetch player list
function fetchPlayerList() {
fetch('https://api.cricapi.com/v1/players?apikey=9df522d1-26ac-494c-9085-484911641a9f&offset=0')
.then(response => response.json())
.then(data => {
const playerListItems = document.getElementById('playerListItems');
playerListItems.innerHTML = ''; // Clear previous content
data.data.forEach(player => {
const playerItem = `
<li>${player.name} - ${player.country}</li>
`;
playerListItems.innerHTML += playerItem;
});
});
}

// Fetch data when the page loads
document.addEventListener('DOMContentLoaded', () => {
fetchCurrentMatches();
fetchLiveScores();
fetchPlayerList();
});
40 changes: 40 additions & 0 deletions Existing_API_Collection/Currency_Converter_API/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Currency Converter

This is a simple currency converter web application built using HTML, CSS, and JavaScript. It allows users to convert currency values from one currency to another based on the latest exchange rates.

## Features

- Users can input a quantity and select a currency to convert from.
- Supports conversion to various currencies including:
- Indian Rupee (INR)
- US Dollar (USD)
- Euro (EUR)
- British Pound (GBP)
- Japanese Yen (JPY)
- Canadian Dollar (CAD)
- Australian Dollar (AUD)
- Swiss Franc (CHF)
- Chinese Yuan (CNY)
- New Zealand Dollar (NZD)
- Singapore Dollar (SGD)
- Hong Kong Dollar (HKD)
- Swedish Krona (SEK)
- Norwegian Krone (NOK)
- Danish Krone (DKK)
- Mexican Peso (MXN)
- Russian Ruble (RUB)
- South African Rand (ZAR)
- Brazilian Real (BRL)
- South Korean Won (KRW)
- Users can submit the form to see the converted values in a table.

## Usage

1. Clone the repository:

2. Open the `index.html` file in your web browser.

3. Enter a quantity and select a currency to convert from.

4. Click the "Submit" button to see the converted values in the table.

65 changes: 65 additions & 0 deletions Existing_API_Collection/Currency_Converter_API/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Currency Converter - Convert your currency</title>
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
</head>

<body class="bg-gray-100 flex flex-col justify-center items-center min-h-screen">
<div class="container max-w-lg bg-white p-8 rounded-lg shadow-lg">
<h1 class="text-2xl font-bold mb-4">Choose a currency to convert</h1>
<form action="/action.php" method="get" class="flex flex-col items-center">
<label for="quantity" class="text-lg mb-2">Choose a quantity:</label>
<input type="number" name="quantity" min="1" max="10" class="border border-gray-300 rounded-md py-2 px-4 mb-4 text-lg">

<label for="currency" class="text-lg mb-2">Choose a currency:</label>
<select name="currency" class="border border-gray-300 rounded-md py-2 px-4 mb-4 text-lg">
<option value="INR">Indian Rupee</option>
<option value="USD">US Dollar</option>
<option value="EUR">Euro</option>
<option value="GBP">British Pound</option>
<option value="JPY">Japanese Yen</option>
<option value="CAD">Canadian Dollar</option>
<option value="AUD">Australian Dollar</option>
<option value="CHF">Swiss Franc</option>
<option value="CNY">Chinese Yuan</option>
<option value="NZD">New Zealand Dollar</option>
<option value="SGD">Singapore Dollar</option>
<option value="HKD">Hong Kong Dollar</option>
<option value="SEK">Swedish Krona</option>
<option value="NOK">Norwegian Krone</option>
<option value="DKK">Danish Krone</option>
<option value="MXN">Mexican Peso</option>
<option value="RUB">Russian Ruble</option>
<option value="ZAR">South African Rand</option>
<option value="BRL">Brazilian Real</option>
<option value="KRW">South Korean Won</option>
</select>

<button class="btn bg-purple-500 text-white py-2 px-4 rounded-md text-lg hover:bg-purple-600 transition duration-300">Submit</button>
</form>

<div class="output mt-8 hidden">
<h2 class="text-xl font-bold mb-4">Here is your converted values in different currencies</h2>
<table class="w-full border-collapse border border-gray-300">
<thead>
<tr class="bg-gray-200">
<th class="py-2 px-4">Currency</th>
<th class="py-2 px-4">Code</th>
<th class="py-2 px-4">Value</th>
</tr>
</thead>
<tbody>

</tbody>
</table>
</div>
</div>

<script src="script.js"></script>
</body>

</html>
Loading

0 comments on commit a044d64

Please sign in to comment.