GNU social JP
  • FAQ
  • Login
GNU social JPは日本のGNU socialサーバーです。
Usage/ToS/admin/test/Pleroma FE
  • Public

    • Public
    • Network
    • Groups
    • Featured
    • Popular
    • People

Notices by Axel Rauschmayer (rauschma@fosstodon.org), page 3

  1. Embed this notice
    Axel Rauschmayer (rauschma@fosstodon.org)'s status on Saturday, 20-Jul-2024 04:01:01 JST Axel Rauschmayer Axel Rauschmayer

    The term “syntactic sugar” is tricky. Common definition: shorter syntax with a simple transformation to a longer version. Think syntax-aware search-and-replace or macros.

    Examples:

    a += b // sugar
    a = a + b // long

    {prop} // sugar
    {prop: prop} // long

    (x) => x + x // sugar
    (x) => { return x } // long

    With this definition, async/await is not syntactic sugar for Promises: An async function is executed similarly to a generator (pausing, resuming, …). So no simple transformation from .then().

    In conversation Saturday, 20-Jul-2024 04:01:01 JST from fosstodon.org permalink
  2. Embed this notice
    Axel Rauschmayer (rauschma@fosstodon.org)'s status on Friday, 05-Jul-2024 23:22:10 JST Axel Rauschmayer Axel Rauschmayer

    My books on #JavaScript and #TypeScript are free to read online:

    – Exploring JavaScript (ES2024 edition)
    – Deep JavaScript
    – Tackling TypeScript
    – Shell scripting with Node.js

    :mastodon: Boosts appreciated!

    https://exploringjs.com

    In conversation Friday, 05-Jul-2024 23:22:10 JST from fosstodon.org permalink

    Attachments


    1. https://cdn.fosstodon.org/media_attachments/files/112/728/248/400/812/792/original/6d59c475bd80572e.jpg

    2. https://cdn.fosstodon.org/media_attachments/files/112/728/249/178/480/735/original/285a98dcde33eced.jpg

    3. https://cdn.fosstodon.org/media_attachments/files/112/728/249/663/745/350/original/e7f704a0b90c05dd.jpg

    4. https://cdn.fosstodon.org/media_attachments/files/112/728/249/909/380/999/original/49765a2a178117e2.jpg
  3. Embed this notice
    Axel Rauschmayer (rauschma@fosstodon.org)'s status on Friday, 17-May-2024 04:29:40 JST Axel Rauschmayer Axel Rauschmayer
    in reply to
    • Sergey Shandar

    @functionalscript You would have to write it (my knowledge is limited here). I’d be happy to review!

    In conversation Friday, 17-May-2024 04:29:40 JST from fosstodon.org permalink
  4. Embed this notice
    Axel Rauschmayer (rauschma@fosstodon.org)'s status on Friday, 17-May-2024 01:30:08 JST Axel Rauschmayer Axel Rauschmayer
    in reply to

    I’ve always found discrete mathematics (*) much easier to understand than, e.g., calculus or statistics – because it is so similar to programming. Relations, orders, graphs are all part of discrete mathematics.

    If you think you don’t like math, you may actually enjoy discrete math.

    (*) https://en.wikipedia.org/wiki/Discrete_mathematics

    In conversation Friday, 17-May-2024 01:30:08 JST from fosstodon.org permalink

    Attachments

    1. Domain not in remote thumbnail source whitelist: upload.wikimedia.org
      Discrete mathematics
      Discrete mathematics is the study of mathematical structures that can be considered "discrete" (in a way analogous to discrete variables, having a bijection with the set of natural numbers) rather than "continuous" (analogously to continuous functions). Objects studied in discrete mathematics include integers, graphs, and statements in logic. By contrast, discrete mathematics excludes topics in "continuous mathematics" such as real numbers, calculus or Euclidean geometry. Discrete objects can often be enumerated by integers; more formally, discrete mathematics has been characterized as the branch of mathematics dealing with countable sets (finite sets or sets with the same cardinality as the natural numbers). However, there is no exact definition of the term "discrete mathematics". The set of objects studied in discrete mathematics can be finite or infinite. The term finite mathematics is sometimes applied to parts...
  5. Embed this notice
    Axel Rauschmayer (rauschma@fosstodon.org)'s status on Friday, 17-May-2024 01:30:08 JST Axel Rauschmayer Axel Rauschmayer

    Math topics that keep being useful for programming: relations, orders, graphs.

    Example: You have plugins with conditions such as “plugin A must run before plugin B“.

    – These conditions define a partial order: In general, not every plugin can be “compared” with every other plugin.
    – If we want to sort an Array with plugins, we need a total order.
    – One algorithm that works with a partial order is topological sorting: https://en.wikipedia.org/wiki/Topological_sorting

    In conversation Friday, 17-May-2024 01:30:08 JST from fosstodon.org permalink

    Attachments

    1. Domain not in remote thumbnail source whitelist: upload.wikimedia.org
      Topological sorting
      In computer science, a topological sort or topological ordering of a directed graph is a linear ordering of its vertices such that for every directed edge (u,v) from vertex u to vertex v, u comes before v in the ordering. For instance, the vertices of the graph may represent tasks to be performed, and the edges may represent constraints that one task must be performed before another; in this application, a topological ordering is just a valid sequence for the tasks. Precisely, a topological sort is a graph traversal in which each node v is visited only after all its dependencies are visited. A topological ordering is possible if and only if the graph has no directed cycles, that is, if it is a directed acyclic graph (DAG). Any DAG has at least one topological ordering, and algorithms are known for constructing a topological ordering of any DAG in linear time. Topological sorting has many applications, especially in ranking problems such as feedback arc set. Topological sorting is possible even when the DAG has disconnected components. Examples The canonical application of...
  6. Embed this notice
    Axel Rauschmayer (rauschma@fosstodon.org)'s status on Thursday, 16-May-2024 01:18:40 JST Axel Rauschmayer Axel Rauschmayer

    Announcing the Web Platform Dashboard:

    “For the first time you'll have a way to see the entire web platform mapped as a set of features, along with their support in browsers.”

    “The Dashboard isn't intended as a replacement for Can I Use or the browser compatibility data on MDN. In your day to day life as a developer, it's likely to be less useful than these places. However, showing the platform in this way creates some interesting possibilities.“

    https://web.dev/blog/web-platform-dashboard

    In conversation Thursday, 16-May-2024 01:18:40 JST from fosstodon.org permalink
  7. Embed this notice
    Axel Rauschmayer (rauschma@fosstodon.org)'s status on Sunday, 28-Apr-2024 00:50:51 JST Axel Rauschmayer Axel Rauschmayer

    Web apps—topics I’d like to be discussed more:
    – Offline capability
    – Peer-to-peer operation (syncing etc.)

    It’s a shame that most web apps cease to work properly whenever the internet connection is flaky or gone. For me, that happens whenever I travel (train, plane, etc.).

    Native apps are better at offline (but not much).

    In conversation Sunday, 28-Apr-2024 00:50:51 JST from fosstodon.org permalink
  8. Embed this notice
    Axel Rauschmayer (rauschma@fosstodon.org)'s status on Friday, 05-Apr-2024 01:33:00 JST Axel Rauschmayer Axel Rauschmayer

    #TypeScript: Arrow functions help with partial evaluation [1] – e.g. a factory for functions for which there already is a type. Then they are more elegant than using .bind() [2]

    const functionFactory = (factoryArg: string): FunctionType => (functionArg) => { … }

    Note that the type of `functionArg` and the result type of the second arrow function are provided by `FunctionType`.

    [1] https://2ality.com/2011/09/currying-vs-part-eval.html
    [2] https://2ality.com/2016/02/arrow-functions-vs-bind.html

    In conversation Friday, 05-Apr-2024 01:33:00 JST from fosstodon.org permalink

    Attachments

    1. No result found on File_thumbnail lookup.
      Currying versus partial application (with JavaScript code)
      Currying and partial application are two ways of transforming a function into another function with a generally smaller arity. While they are often confused with each other, they work differently. This post explains the details.
    2. No result found on File_thumbnail lookup.
      Arrow functions vs. `bind()`
      ES6 arrow functions are often a compelling alternative to Function.prototype.bind().
  9. Embed this notice
    Axel Rauschmayer (rauschma@fosstodon.org)'s status on Tuesday, 02-Apr-2024 06:27:55 JST Axel Rauschmayer Axel Rauschmayer

    EOL—'\n' vs. '\r\n':
    – With files and strings read from files, you can detect the EOL and use it when writing files.
    – On Node.js, you can use os.EOL.

    But what about multi-line strings in error messages that must work in browsers and Node.js? Always '\n'?

    In conversation Tuesday, 02-Apr-2024 06:27:55 JST from fosstodon.org permalink
  10. Embed this notice
    Axel Rauschmayer (rauschma@fosstodon.org)'s status on Wednesday, 13-Mar-2024 11:05:30 JST Axel Rauschmayer Axel Rauschmayer
    in reply to
    • Sergey Shandar

    @functionalscript This API may work for you: https://nodejs.org/api/module.html#customization-hooks

    In conversation Wednesday, 13-Mar-2024 11:05:30 JST from fosstodon.org permalink

    Attachments

    1. No result found on File_thumbnail lookup.
      Modules: node:module API | Node.js v21.7.1 Documentation
  11. Embed this notice
    Axel Rauschmayer (rauschma@fosstodon.org)'s status on Saturday, 09-Mar-2024 10:40:25 JST Axel Rauschmayer Axel Rauschmayer

    1/ I love #TypeScript’s discriminated unions: https://exploringjs.com/tackling-ts/ch_special-values.html#discriminated-unions

    Alas, I often end up switching to classes:

    A. The discriminant is not very sticky:
    – There is no refactoring for renaming it.
    – TS cannot infer the type of an object via a discriminant (only narrow it). In contrast to: new MyClass()

    B. Classes provide locations for initialization code and operations. I could put each DU in its own module but that is often too fine-grained for my taste. Future: submodules?

    In conversation Saturday, 09-Mar-2024 10:40:25 JST from fosstodon.org permalink

    Attachments

    1. No result found on File_thumbnail lookup.
      Adding special values to types • Tackling TypeScript
  12. Embed this notice
    Axel Rauschmayer (rauschma@fosstodon.org)'s status on Saturday, 09-Mar-2024 10:40:24 JST Axel Rauschmayer Axel Rauschmayer
    in reply to

    2/ Experiment (not yet sure if I like it):

    type CTree = CTreeNode | CEmptyTree;
    class CTreeNode {
    left: CTree;
    right: CTree;
    value: string;
    }
    class CEmptyTree {}

    // DU version:
    type DUTree = DUTreeNode | DUEmptyTree;
    type DUTreeNode = {
    kind: 'DUTreeNode',
    left: DUTree,
    right: DUTree,
    value: string,
    };
    type DUEmptyTree = {
    kind: 'DUEmptyTree',
    };

    In conversation Saturday, 09-Mar-2024 10:40:24 JST from fosstodon.org permalink
  13. Embed this notice
    Axel Rauschmayer (rauschma@fosstodon.org)'s status on Saturday, 09-Mar-2024 04:13:11 JST Axel Rauschmayer Axel Rauschmayer

    1/ #TypeScript:
    – My own experience of TypeScript is overwhelmingly positive.
    – But I’m also seeing people complain about its complexity.

    I think both are true:
    1. If you stick with simple types and strict type checking (no `any`), you’ll have a good experience.
    2. Alas, some JavaScript APIs can only be described with very complicated types and then things can get ugly.

    Definitely Typed has some type definitions that I find too complicated.

    In conversation Saturday, 09-Mar-2024 04:13:11 JST from fosstodon.org permalink
  14. Embed this notice
    Axel Rauschmayer (rauschma@fosstodon.org)'s status on Monday, 04-Mar-2024 17:26:07 JST Axel Rauschmayer Axel Rauschmayer

    Todo files for open source projects:
    – My todo files are usually unordered and not ready for public consumption.
    – How do you handle yours? Any tips?

    In conversation Monday, 04-Mar-2024 17:26:07 JST from fosstodon.org permalink
  15. Embed this notice
    Axel Rauschmayer (rauschma@fosstodon.org)'s status on Sunday, 03-Mar-2024 07:52:39 JST Axel Rauschmayer Axel Rauschmayer

    #TypeScript: Stale compiled files can cause issues (when you rename an input file, the old output file isn’t removed). That’s why I occasionally do:

    npm run build

    "scripts": {
    "build": "npm run clean && tsc",
    "clean": "shx rm -rf ./dist/*",
    ···
    }

    shx provides cross-platform shell commands: https://exploringjs.com/nodejs-shell-scripting/ch_package-scripts.html#file-system-operations

    In conversation Sunday, 03-Mar-2024 07:52:39 JST from fosstodon.org permalink

    Attachments

    1. No result found on File_thumbnail lookup.
      Running cross-platform tasks via npm package scripts • Shell scripting with Node.js
  16. Embed this notice
    Axel Rauschmayer (rauschma@fosstodon.org)'s status on Friday, 23-Feb-2024 07:44:30 JST Axel Rauschmayer Axel Rauschmayer

    #TypeScript – occasionally useful:

    type JsonValue =
    | null
    | boolean
    | number
    | string
    | JsonValue[]
    | { [key: string]: JsonValue }
    ;

    In conversation Friday, 23-Feb-2024 07:44:30 JST from fosstodon.org permalink
  17. Embed this notice
    Axel Rauschmayer (rauschma@fosstodon.org)'s status on Monday, 19-Feb-2024 23:18:08 JST Axel Rauschmayer Axel Rauschmayer

    Last week’s ECMAScript News summarizes several interesting things that happened:
    – Should npm be unbundled from Node.js?
    – LLRT, Amazon’s new JavaScript runtime based on QuickJS
    – TC39’s February 2024 meeting
    – Trailer for “Node.js: The Documentary”
    – And more

    You can still subscribe for tomorrow’s issue: https://ecmascript.news

    https://ecmascript.news/archive/es-next-news-2024-02-13.html?utm_source=@rauschma@fosstodon.org&utm_medium=Mastodon&utm_campaign=2024-02-19

    In conversation Monday, 19-Feb-2024 23:18:08 JST from fosstodon.org permalink

    Attachments


  18. Embed this notice
    Axel Rauschmayer (rauschma@fosstodon.org)'s status on Monday, 05-Feb-2024 23:10:41 JST Axel Rauschmayer Axel Rauschmayer

    #TypeScript—I’m trying out this pattern for “enums” with object values:

    const Heading = {
    Part: {
    key: 'Part',
    level: 1,
    },
    Chapter: {
    key: 'Chapter',
    level: 2,
    },
    Section: {
    key: 'Section',
    level: 3,
    },
    } as const;

    // Discriminated union!
    type HeadingType = PropValues<typeof Heading>;
    // Name could be `Heading` but that trips up TS language server in
    // some cases.

    type PropValues<Obj> = Obj[keyof Obj];

    Related: https://exploringjs.com/tackling-ts/ch_enum-alternatives.html

    In conversation Monday, 05-Feb-2024 23:10:41 JST from fosstodon.org permalink

    Attachments

    1. No result found on File_thumbnail lookup.
      Alternatives to enums in TypeScript • Tackling TypeScript
  19. Embed this notice
    Axel Rauschmayer (rauschma@fosstodon.org)'s status on Monday, 29-Jan-2024 22:51:39 JST Axel Rauschmayer Axel Rauschmayer

    Movies and TV: I’d like to see “Roman space empire” instead of “nazi space empire”. Then the story would get more interesting because it wouldn’t simply be about “good vs. evil”—it would have politics in addition to war.

    In conversation Monday, 29-Jan-2024 22:51:39 JST from fosstodon.org permalink
  20. Embed this notice
    Axel Rauschmayer (rauschma@fosstodon.org)'s status on Monday, 29-Jan-2024 05:44:56 JST Axel Rauschmayer Axel Rauschmayer

    I can’t overstate how pleasant it is to consume various kinds of content via feeds. For example, you can group it into categories, which makes it easy to skip things you’re not interested in at the moment.

    Thanks to JSON Feed (*) it is now easier than ever to add feeds to websites. I could even see myself subscribing to a feed instead of an email newsletter to be notified of an important event (such as a product coming out).

    (*) https://www.jsonfeed.org/

    In conversation Monday, 29-Jan-2024 05:44:56 JST from fosstodon.org permalink

    Attachments

    1. No result found on File_thumbnail lookup.
      JSON Feed
  • After
  • Before

User actions

    Axel Rauschmayer

    Axel Rauschmayer

    Topics: #JavaScript #TypeScript #fedi22Other interests:– Languages: German, English, French, Spanish, Dutch, Mandarin– Sustainability, degrowth, permaculture, urbanism– Tiny houses– Education– Psychology, getting out of one’s head, heart-centered living– Minimalist spirituality: Advaita, Daoism, Buddhism, Christian mysticism, J. Krishnamurti, …I live in Munich. http://pronoun.is/heNon-tech:– :pixelfed: Photos: @rauschma– 💬 Languages: @langtales

    Tags
    • (None)

    Following 0

      Followers 0

        Groups 0

          Statistics

          User ID
          14578
          Member since
          29 Oct 2022
          Notices
          77
          Daily average
          0

          Feeds

          • Atom
          • Help
          • About
          • FAQ
          • TOS
          • Privacy
          • Source
          • Version
          • Contact

          GNU social JP is a social network, courtesy of GNU social JP管理人. It runs on GNU social, version 2.0.2-dev, available under the GNU Affero General Public License.

          Creative Commons Attribution 3.0 All GNU social JP content and data are available under the Creative Commons Attribution 3.0 license.