Skip to content

Instantly share code, notes, and snippets.

View rollendxavier's full-sized avatar

Rollend Xavier rollendxavier

View GitHub Profile
terraform {
backend "azurerm" {}
}
provider "azurerm" {
features {}
}
module "network" {
source = "./modules/network"
@rollendxavier
rollendxavier / stock_program.cs
Created December 1, 2022 08:55
Function that takes an array of Stock prices and returns the best profit you could have made from 1 purchase and I sale of yesterday's stock prices
using System;
using System.Collections.Generic;
namespace ConsoleApp3
{
class Program
{
static void Main(string[] args)
{
try
@rollendxavier
rollendxavier / emojis.md
Created February 6, 2023 07:58
Github complete emojis
@rollendxavier
rollendxavier / app_gateway.tf
Created February 9, 2023 07:08
Terraform code to create an Azure App Gateway
data "azurerm_key_vault" "keyvault" {
name = "keyvault"
resource_group_name = var.resource_group_name
}
data "azurerm_key_vault_certificate" "cert" {
name = "kv-cert"
key_vault_id = data.azurerm_key_vault.keyvault.id
}
@rollendxavier
rollendxavier / App.js
Last active March 7, 2024 14:44
Crypto Porfilio Tracker | CoinGecko | React
import React, { useState, useEffect, useMemo } from 'react';
import axios from 'axios';
import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, Legend, PieChart, Pie, Cell, ResponsiveContainer } from 'recharts';
import DatePicker from 'react-datepicker';
import 'react-datepicker/dist/react-datepicker.css';
import './App.css'; // Import the CSS
import NewsTicker from './components/News'; // Import the News components
function CoinDetails({ coin, history }) {
// Prepare the data for the line chart
@rollendxavier
rollendxavier / App.css
Last active March 11, 2024 03:19
Price Tracker css
body {
font-family: Arial, sans-serif;
}
.App {
text-align: center;
}
.App-header {
background-color: #ffffff;
@rollendxavier
rollendxavier / import.js
Last active March 11, 2024 03:26
Price Tracker import.js
import React, { useState, useEffect, useMemo } from 'react';
import axios from 'axios';
import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, Legend, PieChart, Pie, Cell, ResponsiveContainer } from 'recharts';
import DatePicker from 'react-datepicker';
import NewsTicker from './components/News'; // Import the News components
import 'react-datepicker/dist/react-datepicker.css';
import './App.css'; // Import the CSS
@rollendxavier
rollendxavier / CoinDetails.js
Last active March 11, 2024 03:26
Price Tracker CoinDetails,js
function CoinDetails({ coin, history }) {
// Prepare the data for the line chart
const chartData = history.map(dataPoint => ({ date: new Date(dataPoint[0]).toDateString(), price: dataPoint[1] }));
const priceChangeColor = coin.price_change_24h < 0 ? 'red' : 'green';
return (
<div className="coin-details">
<h2>{coin.name} ({coin.symbol.toUpperCase()})</h2>
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'flex-start', width: '100%' }}>
<span style={{ color: priceChangeColor, fontSize: '0.8em' }}>
@rollendxavier
rollendxavier / Appconstanst.js
Last active March 11, 2024 03:26
Price Tracker Appconstanst.js
function App() {
const [coins, setCoins] = useState([]);
const [selectedCoin, setSelectedCoin] = useState(null);
const [history, setHistory] = useState([]);
const [loading, setLoading] = useState(true);
const [startDate, setStartDate] = useState(new Date());
const [endDate, setEndDate] = useState(new Date());
const api_key = 'YOUR_API_KEY'; // replace this with your own API key
const holdings = useMemo(() => holdingsData, []);
@rollendxavier
rollendxavier / fetchingthecoindata.js
Last active March 11, 2024 03:26
Price Tracker Fetching the Coin Data
const COLORS = ['#0088FE', '#00C49F', '#FFBB28', '#FF8042']; // add more colors if you have more coins
useEffect(() => {
axios.get(`https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&ids=${holdings.map(holding => holding.id).join(',')}`, {
headers: {
'X-CoinAPI-Key': api_key
}
})
.then(response => {
const updatedHoldings = holdings.map(holding => {