Skip to content

Instantly share code, notes, and snippets.

View dpilafian's full-sized avatar

Dem Pilafian dpilafian

View GitHub Profile
@sindresorhus
sindresorhus / esm-package.md
Last active April 25, 2024 08:14
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.
@dpilafian
dpilafian / toSalesforceId18.groovy
Last active February 6, 2024 19:45
Groovy function to convert a Salesforce id15 to id18
def toSalesforceId18(String id) {
// Converts a Salesforce id15 to id18.
// Example:
// assert toSalesforceId18("001C000000o4Ooi") == "001C000000o4OoiIAE"
// Details:
// https://blog.centerkey.com/2014/08/groovy-convert-salesforce-id15-id18.html
// MIT License (c) 2019 Pilafian
def valueToCode = { ((it < 26 ? "A" : "0") as char) + it % 26 }
def binaryToCode = { valueToCode(Integer.parseInt(it, 2)) as char }
def tripletToBinary = { it.reverse().replaceAll(/[^A-Z]/, "0").replaceAll(/[^0]/, "1") }
@dpilafian
dpilafian / tree.sh
Last active February 19, 2024 08:23
Unix/Linux Folder Tree
#!/bin/bash
#####################################################
# Unix/Linux Folder Tree v2.9 #
# #
# Displays structure of folder hierarchy #
# ------------------------------------------------- #
# This tiny script uses "ls", "grep", and "sed" #
# in a single command to show the nesting of #
# subfolders. #
# #
@igogrek
igogrek / How I stopped loving Angular.md
Last active April 2, 2024 03:00
How I stopped loving Angular

I've worked with AngularJS for many years now and still use it in production today. Even though you can't call it ideal, given its historically-formed architecture, nobody would argue that it became quite a milestone not only for evolution of JS frameworks, but for the whole web.

It's 2017 and every new product/project has to choose a framework for development. For a long time I was sure that new Angular 2/4 (just Angular below) will become the main trend for enterprise development for years to come. I wasn't even thinking of working with something else.

Today I refuse to use it in my next project myself.

@tdd
tdd / angular-just-say-no.md
Last active November 18, 2022 20:47
Angular: Just Say No

Angular: Just say no

A collection of articles by AngularJS veterans, sometimes even core committers, that explain in detail what's wrong with Angular 1.x, how Angular 2 isn't the future, and why you should avoid the entire thing at all costs unless you want to spend the next few years in hell.

Reason for this: I'm getting tired of having to explain to everyone, chief of which all the indiscriminate Google Kool-Aid™ drinkers, why I have never believed in Angular, why I think it'll publicly fail pretty soon now (a couple years), and why it's a dead end IMO. This gist serves as a quick target I can point people to in order not to have to parrot / compile the core of the articles below everytime. Their compounded reading pretty much captures 99% of my view on the topic.

This page is accessible through http://bit.ly/angular-just-say-no and http://bit.ly/angularjustsayno, btw.