Skip to content

Instantly share code, notes, and snippets.

View vltansky's full-sized avatar
👨‍💻

Vlad Tansky vltansky

👨‍💻
View GitHub Profile
@KevinBatdorf
KevinBatdorf / add-prefix-to-tailwind-ui.js
Last active April 26, 2021 21:09
Add a prefix to Tailwind UI components automatically (with Tampermonkey)
// ==UserScript==
// @name Add TW UI prefix
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Add a prefix to Tailwind UI
// @author https://gist.github.com/KevinBatdorf/d772807789a79f07453c144c772d6a76
// @match https://tailwindui.com/components/*
// @grant none
// ==/UserScript==

Boolean() or !! (double bang, double negation)?

What's the best way to answer the question "true or false?" in JavaScript

JavaScript does not bother you too much with types (at first), which is both a blessing and a cure. But we all know the Boolean type. Boolean variables can either be true or false. Yes or no.

Every value in JavaScript can be translated into a boolean, true or false. Values that translate to true are truthy, values that translate to false are falsy. Simple.

This is about two ways to make that translation.

@swyxio
swyxio / 7rules-for-intemediate-developers-3.md
Last active October 28, 2021 19:29
Clone Open Source Apps

3. Clone Open Source Apps

You already know you should be making projects to learn things and potentially add to your portfolio. You've read your Malcolm Gladwell, you know that you need 10,000 hours of deliberate practice. Given you're just starting out, I have a slightly contentious suggestion for you: DON'T make anything new.

Your decision-making is a scarce resource. You start every day with a full tank, and as you make decisions through the day you gradually run low. We all know how good our late-late-night decisions are. Making a new app involves a thousand micro decisions - from what the app does, to how it should look, and everything in between. Decide now: Do you want to practice making technical decisions or product decisions?

Ok so you're coding. You know what involves making zero product decisions? Cloning things. Resist the urge to make your special snowflake (for now). Oh but then who would use yet another Hacker News clone? I've got news for you: No one was gonna use your thing anyway. You