Skip to content

Instantly share code, notes, and snippets.

@fatihky
fatihky / es-modules-are-terrible-actually.md
Created November 9, 2021 10:21 — forked from joepie91/es-modules-are-terrible-actually.md
ES Modules are terrible, actually

ES Modules are terrible, actually

This post was adapted from an earlier Twitter thread.

It's incredible how many collective developer hours have been wasted on pushing through the turd that is ES Modules (often mistakenly called "ES6 Modules"). Causing a big ecosystem divide and massive tooling support issues, for... well, no reason, really. There are no actual advantages to it. At all.

It looks shiny and new and some libraries use it in their documentation without any explanation, so people assume that it's the new thing that must be used. And then I end up having to explain to them why, unlike CommonJS, it doesn't actually work everywhere yet, and may never do so. For example, you can't import ESM modules from a CommonJS file! (Update: I've released a module that works around this issue.)

And then there's Rollup, which apparently requires ESM to be u

@fatihky
fatihky / README.md
Created December 28, 2020 18:48 — forked from tmilos/README.md
Modified Preorder Tree Traversal

Modified Preorder Tree Traversal

Hierarchical data metrics that allows fast read operations on tree like structures.

Based on Left and Right fields that are set during tree traversal. When entered into node value is set to it's Left, when exiting node value is set to it's Right.

Sample implementation

@fatihky
fatihky / nexthingco-chip-bluetooth-speaker.txt
Created November 10, 2019 13:07
Turn NextThingCo C.H.I.P. into a bluetooth speaker
Here I'll describe how you can turn your NextThingCo C.H.I.P. into a bluetooth speaker.
STEP 1 - Test your jack:
a. Plug your headphone to your C.H.I.P. first.
b. Then put some mp3 files to your C.H.I.P.
c. Try to play them with `mplayer foo.mp3` command.
d. If you hear your song from the headphone, continue to next step.
e. Ok. You can't get sound from the headphone.
I could only hear sound by uninstalling pulseaudio but I don't suggest that way.
If you can, flashing the C.H.I.P. solved the problem for me (easiest and fastest way).
@fatihky
fatihky / how-to-enable-wifi-macbook-mac-mini-air-ubuntu-linux-debian-mint-mate-os.md How to Enable Wi-Fi on MacBook, Mac Mini, MacBook Air for Ubuntu/Linux/Debian/Mint/Mate OS

How to Enable Wi-Fi on MacBook, Mac Mini, MacBook Air for Ubuntu/Linux OS

By default older Mac computer models have driver issues with the Broadcom Wi-Fi chip. Most instructions online (such as this one from the official Ubuntu docs @ https://help.ubuntu.com/community/Macmini5-1/Precise) suggest to use sudo apt-get and install these packages from the PPA.

BUT you don't have Internet so you can't use apt-get! Instead you can use a different computer to download the packages, then transfer them over.

In the instructions below, you will need to replace sid in the download URL's with the proper version of Debian your version of Ubuntu/Linux is using. To find which version you should use, you can view the chart at https://askubuntu.com/questions/445487/what-debian-version-are-the-different-ubuntu-versions-based-on#445496. If you're using jessie for example, then replace all sid with jessie in the links below.

  1. Download b43-fwcutter @ (*
@fatihky
fatihky / free-photoshop.md
Created April 5, 2019 20:40 — forked from molcik/free-photoshop.md
Modify Photoshop to never ending trial

How Does It Work

All you have to do, to extend your trial period, is change number in TrialKey element in application.xml. This file is located in /Library/Application Support/Adobe/Adobe Photoshop/AMT. You can navigate there with this command:

cd /Library/Application\ Support/Adobe/Adobe\ Photoshop\ */AMT

Then you have to open the file and edit it. You can use just TextEdit app.

open -a TextEdit application.xml
@fatihky
fatihky / readme.md
Created November 27, 2018 20:38 — forked from dominictarr/readme.md
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

@fatihky
fatihky / oneliners.sh
Last active May 16, 2018 20:24
oneliners
# daemonize
git clone https://github.com/bmc/daemonize.git && cd daemonize && ./configure && make && sudo make install
04f62805a7b9479b6d02f476e89dedb78d500092efa2edf4f261e47863be2181d414535dc2d3492b8c2c0127b8677fb2bbf9f5401ae167b01d7a54e4e7dcaace8b
@fatihky
fatihky / validator.ts
Created January 13, 2018 16:32
validator typescript
// import vald from './src'
// const res = vald
// .base('string')
// .step('json')
// .base('object')
// .step('keys', {
// foo: vald.base('string').step('min', 10)
// })
// .validate('{"foo": "bar bar bar"}')
@fatihky
fatihky / multi-level-group-by.js
Last active May 13, 2022 12:41
multi level group by, lodash, collections
const _ = require('lodash')
function genrows(groups, groupKey) {
return _.toPairs(groups)
.map(([key, data]) => ({[groupKey]: key, data}))
}
function gengroups(arr, iteratee, key) {
const grouped = _.groupBy(arr, iteratee)
return genrows(grouped, key)