Skip to content

Instantly share code, notes, and snippets.

View Uvacoder's full-sized avatar

uvacoder Uvacoder

View GitHub Profile
@Uvacoder
Uvacoder / sort-on-object-key.js
Created January 1, 2022 22:31 — forked from DavidWells/sort-on-object-key.js
Sort an array by key of object in array
// https://github.com/softvar/js/blob/master/packages/util-array/src/index.ts#L97
function sortOnKey(arr, key, direction = 'asc' ) {
if (!arr || !arr.length || !key) {
return [];
}
const dir = direction === 'asc' ? 1 : -1
arr.sort((a, b) => {
return b[key] > a[key] ? -1 : a[key] > b[key] ? dir : 0;
});
@Uvacoder
Uvacoder / downloads-table.md
Created January 1, 2022 22:30 — forked from DavidWells/downloads-table.md
Nice format for packages table with downloads

Packages

Package Badges Details
typedoc-plugin-markdown typedoc-plugin-markdown Downloads [Readm

Aligning images

left alignment

This is the code you need to align images to the left:

@Uvacoder
Uvacoder / Css Goodies.md
Created December 22, 2021 14:42 — forked from patheticGeek/Css Goodies.md
Some things to work on to get good at styling stuff
@Uvacoder
Uvacoder / bookmarks.md
Created December 22, 2021 14:40 — forked from patheticGeek/bookmarks.md
Some useful things i have in my bookmarks
@Uvacoder
Uvacoder / react-useeffect.md
Created December 16, 2021 13:15
React useEffect cheat sheet

Run once

similar to componentDidMount

import { useEffect } from 'react'

export default function Component() {
    useEffect(() => {
        // code to run when component mounts
@Uvacoder
Uvacoder / screen-media-queries.css
Created December 16, 2021 13:14
CSS screen media queries
@media (min-width: 640px) {
/* mobile (sm) */
}
@media (min-width: 768px) {
/* tablet (md) */
}
@media (min-width: 1024px) {
/* laptop (lg) */
@Uvacoder
Uvacoder / grouping-and-ordering.css
Created December 16, 2021 13:14
How to group and order CSS properties
.selector {
/* Positioning */
position: absolute;
z-index: 10;
top: 0;
right: 0;
/* Display & Box Model */
display: inline-block;
overflow: hidden;
@Uvacoder
Uvacoder / get-github-gists.js
Created December 16, 2021 13:13
Get all GitHub Gists of a user
async function getGithubGists() {
const githubUsername = 'octocat'
const gists = await fetch(
`https://api.github.com/users/${githubUsername}/gists`
)
const gistsJson = await gists.json()
const snippets = []