Skip to content

Instantly share code, notes, and snippets.

View kittaakos's full-sized avatar

Akos Kitta kittaakos

  • Berlin, Germany
View GitHub Profile
@sindresorhus
sindresorhus / esm-package.md
Last active June 21, 2024 06:43
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.

Iterables, AsyncIterables, Observables, Oh My!

I know there is a lot of confusion around Observables, Iterables, AsyncIterables and AsyncObservables. Let's try to break this down and the reasons for each.

Pull versus Push Collections

When it comes to collections, you have two ways of thinking about collections, push versus pull. With pull, the consumer is in control of when you get the items, but with push, you get the values when the producer is ready.

Pull Based Collections

@salomvary
salomvary / README.md
Last active November 19, 2020 11:05
Electron Entitlements for Mac App Store

These are the entitlements files I managed to build an Electron app for Mac App Store distribution.

Tested with Electron 8 on macOS Catalina and Mojave.

Used latest electron-builder for packaging (see package.json for configuration). Should work with other packaging tools but hardened runtime must be turned off.

@FranckFreiburger
FranckFreiburger / duplexify.mjs
Last active November 2, 2022 07:20
nodejs readable and writable stream to duplex stream
import { Duplex } from 'stream'
export default class Duplexify extends Duplex {
constructor(writable, readable) {
super({
readableObjectMode: readable.readableObjectMode,
writableObjectMode: writable.writableObjectMode,
readableHighWaterMark: readable.readableHighWaterMark,
@ersinakinci
ersinakinci / electron-webpack-node-integration-false.md
Last active January 25, 2023 19:03
Making electron-webpack work with nodeIntegration: false

NOTE, April 18, 2020: I wrote this document in February 2019 when I was actively investigating Electron. I haven't used it since then and have largely forgotten what this was for or how electron-webpack works. I vaguely remember the problem, but that's it. It would appear based on the comments below that this document is still coming up in web searches but has become out of date and parts of it don't work. If anyone has specific fixes to my instructions, please leave them in the comments and I'll happily incorporate them.

Using electron-webpack without Node integration

Overview

The current version (as of 2019-02-02) of electron-webpack is set up with the assumption that your BrowserWindow instance has nodeIntegration: true. However, Electron is encouraging users to set nodeIntegration: false as a security precaution, and in the future BrowserWindows will have this setting set to false by default. Doing so now with electron-webpack throws an error because the index.html template has commonjs re

@ghosh
ghosh / micromodal.css
Last active May 30, 2024 21:23
Demo modal styles for micromodal.js and corresponding expected html. If using this, set the `awaitCloseAnimation` in config to true
/**************************\
Basic Modal Styles
\**************************/
.modal {
font-family: -apple-system,BlinkMacSystemFont,avenir next,avenir,helvetica neue,helvetica,ubuntu,roboto,noto,segoe ui,arial,sans-serif;
}
.modal__overlay {
position: fixed;
@joyrexus
joyrexus / README.md
Last active February 24, 2024 15:16
collapsible markdown

collapsible markdown?

CLICK ME

yes, even hidden code blocks!

print("hello world!")
@jangnezda
jangnezda / main.js
Created October 12, 2016 11:44
How to load an external URL in <iframe> using Electron
/*
* By default, Electron (well, underlying Chrome browser) will reject loading external URLs
* to an <iframe>. To circumvent this limitation, we can manipulate response headers from any
* http request and feed them to the Electron window.
*
* The 'onHeadersReceived' listener is documented here:
* http://electron.atom.io/docs/api/session/#webrequestonheadersreceivedfilter-listener
*/
app.on('ready', () => {
@foca
foca / release
Last active March 31, 2023 14:15
Small shell script to create GitHub releases from the command line
#!/usr/bin/env bash
set -e
[ -z "$DEBUG" ] || set -x;
usage() {
echo "$0 <repo> <tag> [<release name>] [-- <asset>...]" >&2;
}
if [ "$1" = "-h" -o "$1" = "--help" ]; then
@subfuzion
subfuzion / curl.md
Last active June 20, 2024 13:48
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.