Skip to content

Instantly share code, notes, and snippets.

@sindresorhus
sindresorhus / esm-package.md
Last active July 15, 2024 20:29
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.
@codito
codito / convert.py
Last active May 16, 2020 07:51
Utility to convert DV1-TTSurekh font to devanagari unicode
# -*- coding: utf-8 -*-
#!/usr/bin/env python2
# usage:
# mkdir /tmp/trial
# git clone https://github.com/sushant354/indic2unicode
# sudo pacman -S python2-ply
# # copy the below code in /tmp/trial and save as convert.py
# cd /tmp/trial
# python2 convert.py input.txt output.txt
"""Python is infinitely beautiful!
This program is a response to the post "Infinite work is less work" by
Damian Conway[1].
This program demonstrates how infinity can be handled elegantly in
Python!
THE PROBLEM:
Write a script to generate first 10 strong and weak prime numbers.
@deepu105
deepu105 / VSCode-extensions
Created June 16, 2019 14:49
VSCode plugins I use
code --install-extension QassimFarid.ejs-language-support
code --install-extension SirTori.indenticator
code --install-extension TimonVS.ReactSnippetsStandard
code --install-extension TwentyChung.jsx
code --install-extension abusaidm.html-snippets
code --install-extension asvetliakov.move-imports
code --install-extension aws-scripting-guy.cform
code --install-extension bierner.markdown-preview-github-styles
code --install-extension ccitiriga.TSMethodCreator
code --install-extension christian-kohler.npm-intellisense
@namedgraph
namedgraph / WebAlgebra.md
Last active May 9, 2023 08:32
A denotational semantics for CRUD operations on RDF datasets

RDF quads

S = I ∪ B

P = I

O = I ∪ B ∪ L

@Rich-Harris
Rich-Harris / what-is-svelte.md
Last active March 27, 2024 06:09
The truth about Svelte

I've been deceiving you all. I had you believe that Svelte was a UI framework — unlike React and Vue etc, because it shifts work out of the client and into the compiler, but a framework nonetheless.

But that's not exactly accurate. In my defense, I didn't realise it myself until very recently. But with Svelte 3 around the corner, it's time to come clean about what Svelte really is.

Svelte is a language.

Specifically, Svelte is an attempt to answer a question that many people have asked, and a few have answered: what would it look like if we had a language for describing reactive user interfaces?

A few projects that have answered this question:

@gaearon
gaearon / modern_js.md
Last active July 18, 2024 10:37
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
@stalkerg
stalkerg / Clipboard.html
Last active January 20, 2022 08:52
Svelte component for copy to clipboard.
<script>
import { tick } from 'svelte';
let valueCopy = null;
export let value = null;
let areaDom;
async function copy() {
valueCopy = value;
await tick();
server {
location ~* (serviceworker\.js)$ {
add_header 'Cache-Control' 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
expires off;
proxy_no_cache 1;
}
}
@anacampesan
anacampesan / copyToClipboard.html
Last active May 20, 2021 10:41
Copy to clipboard without input
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<div id="secretInfo" style="display: none;">secret info</div>
<button type="button" id="btnCopy">Copy hidden info</button>