Skip to content

Instantly share code, notes, and snippets.

View wjx0820's full-sized avatar
🎯
Focusing

wjx0820 wjx0820

🎯
Focusing
  • Guangzhou, China
View GitHub Profile
@dedlim
dedlim / claude_3.5_sonnet_artifacts.xml
Last active July 27, 2024 22:51
Claude 3.5 Sonnet, Full Artifacts System Prompt
<artifacts_info>
The assistant can create and reference artifacts during conversations. Artifacts are for substantial, self-contained content that users might modify or reuse, displayed in a separate UI window for clarity.
# Good artifacts are...
- Substantial content (>15 lines)
- Content that the user is likely to modify, iterate on, or take ownership of
- Self-contained, complex content that can be understood on its own, without context from the conversation
- Content intended for eventual use outside the conversation (e.g., reports, emails, presentations)
- Content likely to be referenced or reused multiple times
@andrew8088
andrew8088 / mapPromises.js
Created February 15, 2024 14:56
Managing Promise Concurrency in JavaScript
function mapPromises(args, callback, concurrency = 3) {
const { promise, resolve } = Promise.withResolvers();
const results = [];
let cursor = 0;
function next() {
if (cursor < args.length) {
const index = cursor++;
void callback(...args[index]).then(value => {
@1Marc
1Marc / reactive.js
Last active July 7, 2024 15:42
Vanilla Reactive System
// Credit Ryan Carniato https://frontendmasters.com/courses/reactivity-solidjs/
let context = [];
export function untrack(fn) {
const prevContext = context;
context = [];
const res = fn();
context = prevContext;
return res;
@bradtraversy
bradtraversy / node_nginx_ssl.md
Last active July 25, 2024 06:56
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user

@RayPS
RayPS / ray-zim.zsh-theme
Last active April 11, 2023 11:54
A zsh theme made for myself, please use with FiraCode font
# https://github.com/zimfw/git-info
# Requires the `git-info` zmodule to be included in the .zimrc file.
if (( ! ${+MAGENTA} )) typeset -g MAGENTA=magenta
if (( ! ${+YELLOW} )) typeset -g YELLOW=yellow
if (( ! ${+GREEN} )) typeset -g GREEN=green
if (( ! ${+CYAN} )) typeset -g CYAN=cyan
if (( ! ${+RED} )) typeset -g RED=red
if (( ! ${+BLUE} )) typeset -g BLUE=blue
if (( ! ${+BLACK} )) typeset -g BLACK=black
import PropTypes from 'prop-types';
type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
type Defined<T> = T extends undefined ? never : T;
/**
* Get the type that represents the props with the defaultProps included.
*
* Alternatively, we could have done something like this:
@oliveratgithub
oliveratgithub / emojis.json
Last active July 25, 2024 07:18
Emoji-list with emojis, names, shortcodes, unicode and html entities [massive list]
{
"emojis": [
{"emoji": "👩‍👩‍👧‍👧", "name": "family: woman, woman, girl, girl", "shortname": ":woman_woman_girl_girl:", "unicode": "1F469 200D 1F469 200D 1F467 200D 1F467", "html": "&#128105;&zwj;&#128105;&zwj;&#128103;&zwj;&#128103;", "category": "People & Body (family)", "order": ""},
{"emoji": "👩‍👩‍👧‍👦", "name": "family: woman, woman, girl, boy", "shortname": ":woman_woman_girl_boy:", "unicode": "1F469 200D 1F469 200D 1F467 200D 1F466", "html": "&#128105;&zwj;&#128105;&zwj;&#128103;&zwj;&#128102;", "category": "People & Body (family)", "order": ""},
{"emoji": "👩‍👩‍👦‍👦", "name": "family: woman, woman, boy, boy", "shortname": ":woman_woman_boy_boy:", "unicode": "1F469 200D 1F469 200D 1F466 200D 1F466", "html": "&#128105;&zwj;&#128105;&zwj;&#128102;&zwj;&#128102;", "category": "People & Body (family)", "order": ""},
{"emoji": "👨‍👩‍👧‍👧", "name": "family: man, woman, girl, girl", "shortname": ":man_woman_girl_girl:", "unicode": "1F468 200D 1F469 200D 1F467 200D 1F467", "html": "&#128104;&zwj;&#128105;&z