Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@sindresorhus
sindresorhus / esm-package.md
Last active April 23, 2024 05:25
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@thomasfr
thomasfr / Git push deployment in 7 easy steps.md
Last active April 2, 2024 14:57
7 easy steps to automated git push deployments. With small and configurable bash only post-receive hook
@bcoe
bcoe / npm-top.md
Last active March 23, 2024 20:02
npm-top.md

npm Users By Downloads (git.io/npm-top)


npm users sorted by the monthly downloads of their modules, for the range May 6, 2018 until Jun 6, 2018.

Metrics are calculated using top-npm-users.

# User Downloads
@joepie91
joepie91 / getting-started.md
Last active February 21, 2024 14:45
Getting started with Node.js

"How do I get started with Node?" is a commonly heard question in #Node.js. This gist is an attempt to compile some of the answers to that question. It's a perpetual work-in-progress.

And if this list didn't quite answer your questions, I'm available for tutoring and code review! A donation is also welcome :)

Setting expectations

Before you get started learning about JavaScript and Node.js, there's one very important article you need to read: Teach Yourself Programming in Ten Years.

Understand that it's going to take time to learn Node.js, just like it would take time to learn any other specialized topic - and that you're not going to learn effectively just by reading things, or following tutorials or courses. _Get out there and build things!

@Mevrael
Mevrael / WebSocketController.php
Created March 14, 2017 10:40
Laravel + WebSocket (Ratchet/ReactPHP) integration
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Cookie;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Session;
use Ratchet\WebSocket\Version\RFC6455\Connection;
@joepie91
joepie91 / wildcard-certificates.md
Last active September 16, 2023 18:11
Why you probably shouldn't use a wildcard certificate

Recently, Let's Encrypt launched free wildcard certificates. While this is good news in and of itself, as it removes one of the last remaining reasons for expensive commercial certificates, I've unfortunately seen a lot of people dangerously misunderstand what wildcard certificates are for.

Therefore, in this brief post I'll explain why you probably shouldn't use a wildcard certificate, as it will put your security at risk.

A brief explainer

It's generally pretty poorly understood (and documented!) how TLS ("SSL") works, so let's go through a brief explanation of the parts that are important here.

The general (simplified) idea behind how real-world TLS deployments work, is that you:

@JohnBra
JohnBra / GlowingGradientBorderButton.tsx
Last active September 15, 2023 16:14
A TailwindCSS glowing gradient border button
import React from 'react'
function cn(...classes: any[]) {
return classes.filter(Boolean).join(' ')
}
type Props = {
gradient: string // 'bg-gradient-to-r from-red-600 via-purple-600 to-blue-600',
children: React.ReactNode
href: string
@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.

@joepie91
joepie91 / promises-faq.md
Last active June 25, 2023 09:02
The Promises FAQ - addressing the most common questions and misconceptions about Promises.
# Put this in your .zshrc or .bashrc file
# Install `tree` first — brew install tree
function t() {
# Defaults to 3 levels deep, do more with `t 5` or `t 1`
# pass additional args after
tree -I '.git|node_modules|bower_components|.DS_Store' --dirsfirst --filelimit 15 -L ${1:-3} -aC $2
}