Skip to content

Instantly share code, notes, and snippets.

View harrytran998's full-sized avatar
💎
Build right things what matters!

Harry Tran harrytran998

💎
Build right things what matters!
View GitHub Profile
@harrytran998
harrytran998 / es2069.code-snippets
Created November 10, 2023 04:28
Next Js Project Snippet VsCode
{
"Import type": {
"prefix": "impt",
"body": ["import type { $2 } from '$1'"],
"description": "Import type"
},
"Console log": {
"prefix": "clg",
"body": ["console.log($1)"],
"description": "Console log"
@harrytran998
harrytran998 / [lang]slash[slug].astro
Created July 10, 2022 15:01 — forked from IanVS/[lang]slash[slug].astro
Redirecting i18n pages in Astro
---
import Layout from '../../layouts/MainLayout.astro';
import {getLanguageFromFilename, getSlugFromFilename} from '../../languages';
export async function getStaticPaths() {
/**
* This builds up a set of params using the filename (which is always in english) as the slug,
* and adds a redirect prop to the proper internationalized slug.
*/
function getRedirects(allPages) {
@harrytran998
harrytran998 / reset.css
Created June 25, 2022 06:06 — forked from EllyLoel/reset.css
CSS Reset
/*
Made by Elly Loel - https://ellyloel.com/
With inspiration from:
- Josh W Comeau - https://courses.joshwcomeau.com/css-for-js/treasure-trove/010-global-styles/
- Andy Bell - https://piccalil.li/blog/a-modern-css-reset/
- Adam Argyle - https://unpkg.com/open-props@1.3.16/normalize.min.css / https://codepen.io/argyleink/pen/KKvRORE
Notes:
- `:where()` is used to lower specificity for easy overriding.
*/

Re: selfies project written in CRA and PWA

  • Planning of a project

    • The project planning is mostly based on Fullstack Project Planning.

      For most of my projects, especially recently, I've been following a planning process that helps me breakdown the project into component parts that help me build more efficiently.

  • React Project Structure

@harrytran998
harrytran998 / Gradient Version
Created March 6, 2022 08:03
Use SVG like the background image
.box {
background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="500" ><defs><linearGradient id="grad" x1="0%" y1="0%" x2="100%" y2="100%"><stop offset="0%" stop-color="%23ad3" /><stop offset="100%" stop-color="%23add" /></linearGradient></defs><path d="M0 10 C30 28 38 0 64 10 L64 0 L0 0 Z" fill="url(%23grad)"/></svg>'),
linear-gradient(to bottom right, #de350b, #0065ff);
}
@harrytran998
harrytran998 / Windows cloudSettings
Last active October 17, 2021 15:42
Visual Studio Code Settings Sync Gist
{"lastUpload":"2021-10-17T15:40:16.106Z","extensionVersion":"v3.4.3"}
@harrytran998
harrytran998 / react-rendering.md
Created March 23, 2021 13:33 — forked from tuhuynh27/react-rendering.md
A (Mostly) Complete Guide to React Rendering Behavior

Translated from https://blog.isquaredsoftware.com/2020/05/blogged-answers-a-mostly-complete-guide-to-react-rendering-behavior/, author: Mark Erikson (from Redux team)

A (Mostly) Complete Guide to React Rendering Behavior

Bài viết cung cấp chi tiết về cách mà React render hoạt động, và việc sử dụng Context và Redux ảnh hưởng thế nào tới quá trình render của React.

"Render" là gì

Rendering is the process of React asking your components to describe what they want their section of the UI to look like, now, based on the current combination of props and state.

@harrytran998
harrytran998 / .bash_aliases
Created March 13, 2021 15:36 — forked from vratiu/.bash_aliases
Git shell coloring
# Customize BASH PS1 prompt to show current GIT repository and branch.
# by Mike Stewart - http://MediaDoneRight.com
# SETUP CONSTANTS
# Bunch-o-predefined colors. Makes reading code easier than escape sequences.
# I don't remember where I found this. o_O
# Reset
Color_Off="\[\033[0m\]" # Text Reset
@harrytran998
harrytran998 / tailwind.config.js
Created March 9, 2021 14:51 — forked from paulovieira/tailwind.config.js
tailwind configuration for a medium size svelte/sapper project
// reference: https://tailwindcss.com/docs/configuration
let Path = require('path');
let TailwindUi = require('@tailwindcss/ui')
let TailwindDebugScreens = require('./plugins/tailwindcss-debug-screens.js'); // customized: https://github.com/jorenvanhee/tailwindcss-debug-screens/issues/3
let TailwindFilters = require('tailwindcss-filters');
let defaultTheme = require('tailwindcss/defaultTheme')
console.log({ 'process.env.NODE_ENV': process.env.NODE_ENV });
@harrytran998
harrytran998 / eager-computed-options-alt.ts
Created February 27, 2021 01:46 — forked from Akryum/eager-computed-options-alt.ts
Eager Vue computed property - use for cheap computed properties that always update but that don't trigger updates when their value doesn't change
export function useEagerComputed() {
const properties = []
function eagerComputed(definitions) {
const computedProps = {}
for (const key in definitions) {
const effect = definitions[key]
properties.push({ key, effect })
computedProps[key] = function () {
return this.$data[key]