Skip to content

Instantly share code, notes, and snippets.

// style 1
function asynchronouslyConstructTransformedObject(order) {
return Promise.try(() => {
return Promise.props(Object.assign({}, order, {
date: order.date,
item: getItem(order.item),
payments: Promise.map(order.payments, (paymentObject) => {
return Promise.props({
payment: getPayment(paymentObject.payment),
amountCents: paymentObject.amountCents,
@alextes
alextes / async-await.md
Last active December 27, 2016 10:05
Getting Async / Await now with Babel

Async / Await with Babel.js

Natively with Node.js

As of writing this (26-12-16) Node does not support Async / Await yet. To check if it does now head over to node.green. In case you're thinking, but the harmony flag!, yes, node at this moment has a harmony flag that enables an unstable implementation of Async / Await. It is however, for good reason marked unstable. Use features behind harmony flags for testing only. Not for things that will at any point in the future be deployed.

Compiling with Babel

In short, babel lets you use next generation JavaScript today. If you want to use some language feature that is marked red on node.green or for other environments like browsers, one of these compatibility tables chances are Babel can get you there. The cost will be having to compile your source code from JavaScript to JavaScript. The difference being that some language features will be rewritten

@alextes
alextes / getting-started-eslint.md
Last active January 25, 2018 03:36
Helpful pointers when getting started with ESLint.

Getting Started With ESLint

So you have a JavaScript project and want to start linting it, great! There are a couple choices you need to make and a few things you should know. I will try to make the process a breeze.

Setting Up ESLint

Before we dive in, there are two things you'll have to keep in mind:

  • You can install ESLint globally and locally. I would advise you use the local installation method. We'll make it convenient later.
  • When running ESLint's initialization command: ./node_modules/.bin/eslint --init you'll get a few options to kick-start configuration. I would encourage you to opt to Use a popular style guide followed by picking the airbnb one. It is the most popular style guide and I feel a great starting point. You can always overwrite the rules later.
  • Complete the local installation guide.

Adding ES

Getting Started with NodeJS (WIP)

Learn as you go

Start with dreaming up something you want to build, then go and learn things as you go. Lookup or ask what the best way is to accomplish something.

Getting started

No programming experience? javascripting or Eloquent JavaScript

Keybase proof

I hereby claim:

  • I am alextes on github.
  • I am alextes (https://keybase.io/alextes) on keybase.
  • I have a public key ASAOBVBj1U5OPQD2s6BMh4KqESqsMjRYJLNZT5PHLHs4Pgo

To claim this, I am signing this object:

Package: libws-commons-util-java
Status: install ok installed
Priority: optional
Section: java
Installed-Size: 101
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Architecture: all
Version: 1.0.1-7
Description: Common utilities from the Apache Web Services Project
This is a small collection of utility classes, that allow high
@alextes
alextes / package.json
Created November 10, 2021 09:25
stream postgres rows to javascript
{
"name": "stream-rows",
"version": "1.0.0",
"main": "index.js",
"dependencies": {
"postgres": "^2.0.0-beta.10"
}
}
@alextes
alextes / Day1.purs
Last active December 2, 2021 22:54
Solutions to Day 1 of Advent of Code in PureScript
module Day1 (getPuzzleInput, getSolution1, getSolution2) where
import Prelude
import Data.Array as Array
import Data.Foldable as Foldable
import Data.Int as Int
import Data.String (Pattern(..))
import Data.String as Str
import Effect (Effect)
import Node.Encoding (Encoding(..))
@alextes
alextes / make_twitter_entities_elements.ts
Created March 25, 2022 13:25
Turning a plain text Twitter bio into one containing urls, mentions, hashtags, and cashtags using TypeScript and React.
// Types describing the various objects found in twitter's entities.
type LinkableUrl = {
display_url: string;
end: number;
expanded_url: string;
start: number;
};
type LinkableMention = {
start: number;
This file has been truncated, but you can view the full file.
[
{
"id": "118",
"name": "MakerDAO",
"address": "0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2",
"symbol": "MKR",
"url": "https://makerdao.com/",
"description": "Builders of Dai, a digital currency that can be used by anyone, anywhere.\r\n",
"chain": "Ethereum",
"logo": "https://icons.llama.fi/makerdao.jpg",