Skip to content

Instantly share code, notes, and snippets.

View program247365's full-sized avatar
💭
YOLO 💯

Kevin Ridgway program247365

💭
YOLO 💯
View GitHub Profile
@statico
statico / ...README.md
Last active February 7, 2019 09:03
Top-level monorepo TypeScript/JavaScript style with tslint and Prettier

Goals

  • A single style for our projects and others
  • Minimize customization - Any decided-upon style is better than one we can bikeshed
  • Minimize friction - Instead of warnings, sources are formatted automatically on commit and on save inside your editor
  • Minimize files - These three or four files need only be at the top level of the monorepo... nothign in the subdirs

Why X?

  • Prettier, no semicolons - Because you don't need them and they add unnecessary visual clutter. Prettier will figure out when they're needed for you.
function App() {
const [nickname, setNickname] = useState("");
const [email, setEmail] = useState("");
const [joined, setJoined] = useState(false);
const [msg, setMsg] = useState("");
const [messages, setMessages] = useState({});
const chatRoom = db.ref().child('chatrooms').child('global');
useEffect(() => {
@dominictarr
dominictarr / readme.md
Created November 26, 2018 22:39
statement on event-stream compromise

Hey everyone - this is not just a one off thing, there are likely to be many other modules in your dependency trees that are now a burden to their authors. I didn't create this code for altruistic motivations, I created it for fun. I was learning, and learning is fun. I gave it away because it was easy to do so, and because sharing helps learning too. I think most of the small modules on npm were created for reasons like this. However, that was a long time ago. I've since moved on from this module and moved on from that thing too and in the process of moving on from that as well. I've written way better modules than this, the internet just hasn't fully caught up.

@broros

otherwise why would he hand over a popular package to a stranger?

If it's not fun anymore, you get literally nothing from maintaining a popular package.

One time, I was working as a dishwasher in a restu

// UPDATE: don't use this. when it re-partitions the list when time moves forward, it does not correctly keep hashes
// Use a real merkle tree instead: https://gist.github.com/jlongster/f431b6d75ef29c1a2ed000715aef9c8c
import Timestamp from './timestamp';
// This is a compact data structure that keeps track of a list of
// hashes (representing messages) over a range of time in order to
// figure out what has changed between clients, kinda like a Merkle
// tree. It creates "buckets" that represent different time ranges,
// and divides time into smaller buckets the more recent they are. The
@necolas
necolas / Composite-Link.js
Created September 19, 2018 23:02
Next.js links with React Native for Web
@marianzange
marianzange / coinbaseProSignature.js
Created August 20, 2018 13:19
Coinbase Pro HMAC signature generation for Postman
// Computes the HMAC for requests sent to the Coinbase Pro API.
//
// - Add the following code as Postman pre-request script
// - Adapt the getPatch function an the variable names according to your needs
const timestamp = Date.now() / 1000;
function getPath(url) {
// URL path regex works only if your URLs look like this: {{api_url}}/resource
// If you use hardcoded URLs or any other scheme, adapt the regex pattern!
@TooTallNate
TooTallNate / Dockerfile
Created July 17, 2018 22:08
Node.js + Dockerfile
# This is the "base image" which contains Alpine Linux and Node.js v10.x.x preinstalled
FROM mhart/alpine-node:10
# Use the `NPM_TOKEN` build arg to create the `~/.npmrc` file
ARG NPM_TOKEN
RUN echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc
# Set the working direcrory to `/usr/src`
WORKDIR /usr/src
@gaearon
gaearon / modern_js.md
Last active April 14, 2025 19:22
Modern JavaScript in React Documentation

If you haven’t worked with JavaScript in the last few years, these three points should give you enough knowledge to feel comfortable reading the React documentation:

  • We define variables with let and const statements. For the purposes of the React documentation, you can consider them equivalent to var.
  • We use the class keyword to define JavaScript classes. There are two things worth remembering about them. Firstly, unlike with objects, you don't need to put commas between class method definitions. Secondly, unlike many other languages with classes, in JavaScript the value of this in a method [depends on how it is called](https://developer.mozilla.org/en-US/docs/Web/Jav
@swalkinshaw
swalkinshaw / tutorial.md
Last active February 26, 2025 21:15
Designing a GraphQL API
@developit
developit / *state-machine-component.md
Last active February 6, 2021 00:44
265b lib for building pure functional state machine components. https://github.com/developit/state-machine-component

state-machine-component

A tiny (265 byte) utility to create state machine components using two pure functions.

🔥 JSFiddle Demo

Usage

The API is a single function that accepts 2 pure functions as arguments: