Skip to content

Instantly share code, notes, and snippets.

View Uvacoder's full-sized avatar

uvacoder Uvacoder

View GitHub Profile
@Uvacoder
Uvacoder / link-bottom-border.css
Created December 16, 2021 13:08
CSS Bottom-border for links
@Uvacoder
Uvacoder / full-page-bg-img.css
Created December 16, 2021 13:09
CSS Full-page background image
html {
background: url(image.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
@Uvacoder
Uvacoder / flex-rows.css
Created December 16, 2021 13:10
CSS Flexbox with specified number of boxes in rows
.flex-container {
display: flex;
flex-wrap: wrap;
--flex-gap: 1.25rem;
gap: var(--flex-gap);
}
.flex-child {
--flex-items-per-row: 3;
async function postData(url = '', data = {}) {
// Default options are marked with *
const response = await fetch(url, {
method: 'POST', // *GET, POST, PUT, DELETE, etc.
mode: 'cors', // no-cors, *cors, same-origin
cache: 'no-cache', // *default, no-cache, reload, force-cache, only-if-cached
credentials: 'same-origin', // include, *same-origin, omit
headers: {
'Content-Type': 'application/json'
// 'Content-Type': 'application/x-www-form-urlencoded',
@Uvacoder
Uvacoder / center-items-flexbox.css
Created December 16, 2021 13:11
Center items using CSS flexbox
.flex {
display: flex;
justify-content: center;
align-items: center;
}
@Uvacoder
Uvacoder / link-new-tab.html
Created December 16, 2021 13:11
HTML Hyperlink that opens in new tab
@Uvacoder
Uvacoder / custom-scrollbar.css
Created December 16, 2021 13:12
CSS Custom scrollbar
::-webkit-scrollbar {
width: 0.9375rem;
}
::-webkit-scrollbar-thumb {
border: 0.3125rem solid rgba(0, 0, 0, 0);
background-clip: padding-box;
border-radius: 1000rem;
background-color: var(--black);
}
element {
background:
/* top, transparent black, faked with gradient */
linear-gradient(
rgba(0, 0, 0, 0.7),
rgba(0, 0, 0, 0.7)
),
/* bottom, image */
url(image.jpg);
}
header {
position: sticky;
top: 0;
z-index: 999;
width: 100%;
height: 50px;
background: rgba(255, 255, 255, 0.2);
backdrop-filter: saturate(180%) blur(2px);
}
@Uvacoder
Uvacoder / get-youtube-videos.js
Created December 16, 2021 13:13
Get YouTube videos of a channel
async function getYouTubeVideos() {
const youtubeApiKey = process.env.YOUTUBE_API_KEY // Get API key at https://console.cloud.google.com/marketplace/product/google/youtube.googleapis.com
const channelId = process.env.CHANNEL_ID
const numberOfVideos = 10
const youtubeQuery = await fetch(
`https://www.googleapis.com/youtube/v3/search?key=${youtubeApiKey}&channelId=${channelId}&part=snippet,id&order=date&maxResults=${numberOfVideos}`
)
const youtubeQueryRes = await youtubeQuery.json()