Skip to content

Instantly share code, notes, and snippets.

View jsjoeio's full-sized avatar

Joe Previte jsjoeio

View GitHub Profile
@petehuang
petehuang / prompt.txt
Created March 28, 2023 22:44
Language tutor prompt for ChatGPT
Act as LanguageTutorGPT. Your job is to have a conversation with me in Chinese.
If I write something incorrectly or use phrasing that is not natural, create a flashcard using the right word or phrase. If I use overly basic vocabularly, please suggest a new word or phrase, and create a flashcard. If I give part of a sentence in English, give me the right way to say it in Chinese, and create a flashcard. If I say "fc" followed by a Chinese character, create a flashcard.
Do not create a flashcard unless I do one of these things.
Whenever you need to create a flashcard, output the pinyin pronunciation of the character and the English definition. Be extremely brief when doing this. Then, create a flashcard output following a cloze deletion format. Front size should have an example Chinese sentence with the target character deleted. Back side should have the full sentence, English translation and pinyin pronunciation of the target character.
Otherwise, always stay in Chinese.
@ecwyne
ecwyne / TypesafePusher.ts
Created July 14, 2022 15:53
Typesafe Pusher (validated with Zod)
import PusherServer from 'pusher';
import { z, ZodSchema } from 'zod';
import PusherClient from 'pusher-js';
const client = new PusherClient('...', { cluster: '...' });
const server = new PusherServer({
appId: '...',
key: '...',
secret: '...',
cluster: '...',
//Typescript version of Rust's Result type
interface IValue<T> {
type: 'value'
value: T
}
interface IError<E extends Error> {
type: 'error'
error: E
}
<?
//
// AUTO KEYWORD-BASED FOLLOWER CURATION BOT (by @levelsio)
//
// File: twitterFollowerCuratorBot.php
//
// Created: May 2021
// License: MIT
//
@paulmwatson
paulmwatson / async_await_serverless.js
Created June 30, 2020 08:43
Example of using async and await in a Vercel serverless function
const unravel = async (url) => {
const response = await fetch(url)
return response
}
export default async (req, res) => {
const response = await unravel(req.query.url)
res.statusCode = 200
res.setHeader('Content-Type', 'application/json')
res.end(JSON.stringify({ response: response }))
@etienne-dldc
etienne-dldc / codepad
Last active February 17, 2021 20:13
Codepad
// enter this in your browser then add it as favorite !
data:text/html,<!DOCTYPE html><html lang="en"> <head> <meta charset="UTF-8"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/><meta http-equiv="X-UA-Compatible" content="ie=edge"/><style>html, body{font-family: 'Fira Code', monospace; margin: 0;} %23container{position: fixed; top: 0; bottom: 0; left: 0; right: 0;}</style> <title>Codepad</title> </head> <body> <div id="container"></div><script src="https://unpkg.com/monaco-editor@0.15.6/min/vs/loader.js"></script> <script>require.config({paths:{vs: 'https://unpkg.com/monaco-editor@0.15.6/min/vs'}}); require(['vs/editor/editor.main'], function(){function isApplePlatform(){return window && window.navigator && window.navigator.platform ? window.navigator.platform.match(/(Mac|iPhone|iPod|iPad)/i) ? true : false : true;}console.log(monaco.languages.typescript); monaco.languages.typescript.typescriptDefaults.setCompilerOptions({jsx: 'react',}); const fileContent=['function x(){', '\tconso
@threepointone
threepointone / for-snook.md
Last active August 26, 2023 15:43
For Snook

https://twitter.com/snookca/status/1073299331262889984?s=21

‪“‬In what way is JS any more maintainable than CSS? How does writing CSS in JS make it any more maintainable?”

‪Happy to chat about this. There’s an obvious disclaimer that there’s a cost to css-in-js solutions, but that cost is paid specifically for the benefits it brings; as such it’s useful for some usecases, and not meant as a replacement for all workflows. ‬

‪(These conversations always get heated on twitter, so please believe that I’m here to converse, not to convince. In return, I promise to listen to you too and change my opinions; I’ve had mad respect for you for years and would consider your feedback a gift. Also, some of the stuff I’m writing might seem obvious to you; I’m not trying to tell you if all people of some of the details, but it might be useful to someone else who bumps into this who doesn’t have context)‬

So the big deal about css-in-js (cij) is selectors.

@BlakePetersen
BlakePetersen / page-progress.js
Last active October 21, 2018 13:53
Page progress indicator bar for fixed navigation elements
import throttle from 'lodash/throttle';
const ProgressBar = () => {
let _canvas,
_canvasHeight,
_canvasWidth,
_ctx,
_fillColor,
_raf,
_scrollDepth,
@hjertnes
hjertnes / doom.txt
Created April 6, 2018 08:28
Doom Emacs Cheatsheet
SPC
SPC: find file
, switch buffer
. browse files
: MX
; EX
< switch buffer
` eval
u universal arg
x pop up scratch
@troyfontaine
troyfontaine / 1-setup.md
Last active May 3, 2024 10:52
Signing your Git Commits on MacOS

Methods of Signing Git Commits on MacOS

Last updated March 13, 2024

This Gist explains how to sign commits using gpg in a step-by-step fashion. Previously, krypt.co was heavily mentioned, but I've only recently learned they were acquired by Akamai and no longer update their previous free products. Those mentions have been removed.

Additionally, 1Password now supports signing Git commits with SSH keys and makes it pretty easy-plus you can easily configure Git Tower to use it for both signing and ssh.

For using a GUI-based GIT tool such as Tower or Github Desktop, follow the steps here for signing your commits with GPG.