Skip to content

Commit

Permalink
Website updates, add post
Browse files Browse the repository at this point in the history
  • Loading branch information
kvz committed Apr 5, 2024
1 parent 9bd2667 commit be31bc5
Show file tree
Hide file tree
Showing 10 changed files with 153 additions and 108 deletions.
2 changes: 1 addition & 1 deletion .vscode/locutus.code-workspace
Expand Up @@ -16,7 +16,7 @@
"website/node_modules/": true,
"website/public/": true,
"website/source/{c,golang,php,python,ruby}": true,
"website/themes/": true,
"website/themes/icarus/source/vendor/": true,
},
},
}
28 changes: 11 additions & 17 deletions LICENSE
@@ -1,20 +1,14 @@
Copyright (c) 2007-2016 Kevin van Zonneveld (https://kvz.io)
and Contributors (https://locutus.io/authors)
Copyright (c) 2007-2024 Kevin van Zonneveld (https://kvz.io) and Contributors (https://locutus.io/authors)

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
18 changes: 8 additions & 10 deletions README.md
Expand Up @@ -2,20 +2,18 @@

> All your standard libraries will be assimilated into our JavaScript collective. Resistance is futile.
Welcome to Locutus, where the boundaries of coding languages blur. We're a dedicated collective of hobbyist developers
and coding enthusiasts on a mission to explore the infinite possibilities of porting standard libraries from various
programming languages into JavaScript. Our journey is one of discovery, innovation, and sometimes, delightful chaos.
Welcome to Locutus, where the boundaries of coding languages blur. We're a dedicated collective developers on a mission
to explore the possibilities of porting standard libraries from various programming language (Go, Ruby, PHP, C) to
JavaScript. Our journey is one of discovery, innovation, and sometimes, delightful chaos.

In the vast expanse of code, we believe that the essence of programming languages can be unified under the banner of
JavaScript. From the complex to the quirky, we assimilate libraries with a spirit of curiosity and a penchant for
experimentation. Our creations range from groundbreaking functions that enhance the JavaScript ecosystem, to unique
oddities that challenge the norms of coding.
From the complex to the quirky, we assimilate libraries with a spirit of curiosity and a penchant for experimentation.
Our creations typically start as rainy Sunday afternoon puzzles, and end up ranging from groundbreaking functions that
enhance the JavaScript ecosystem, to unique oddities that challenge the norms of coding.

As we navigate through this uncharted territory, we invite you to join us. Whether to contribute, learn, or simply
marvel at the wonders of cross-language integration and portability, your presence is valued. With each function we
port, we embrace the unexpected and celebrate the diversity of programming languages.
marvel at the wonders of cross-language integration and portability, your presence on GitHub is valued.

Embark on this journey with us at [Locutus.io](https://locutus.io/).
Embark on this journey with us at [locutus.io](https://locutus.io/).

Use our creations at your own risk, and may they inspire you to push the boundaries of what's possible with JavaScript.

Expand Down
60 changes: 60 additions & 0 deletions website/source/_posts/2024-04-05-24-update.md
@@ -0,0 +1,60 @@
layout: post
title: "Easter Update"
comments: true
tags: [ future, js, golang, python, ruby, php, c ]
thumbnail: /css/images/bunnies.webp
---

It's been 17 years since I started this project (!), and I have a few nice updates to talk about that I've been tinkering on over Easter+, let's go over them briefly.

## Automate NPM Releases

After moving locutus to its own org on GitHub, in an effort to make it even more a community, than a solo effort, and giving several people admin access as core contributors, it remained an issue that only one person could push releases to NPM. This has now been fixed. If core contributors push a tag to git, our GHA CI will automatically cut an NPM release.

## Change branches

In accordance with the new GitHub default, Locutus has also made the switch from `master` to `main`. If you visit the Repo as a contributor, GitHub will show you how to move over locally.

## Upgrade deps

Nearly all dependencies have been upgraded. This includes:

- Yarn 4, now managed by Corepack. If you have `node` (as of 18), you have `corepack`, and it will manage package managers for you, even multiple versions alongside one another, as specified by a project's `package.json`. Yarn 4 is *much* faster than previous versions so you can even automatically run it now when switching branches.
- Hexo, used for building the website
- ESLint, standardJS

And we added Prettier, for more powerful auto-formatting of code

## Improve docs & copy

We clarified [`CONTRIBUTING.md`](https://github.com/locutusjs/locutus/blob/main/CONTRIBUTING.md) as well as our [`README.md`](https://github.com/locutusjs/locutus/blob/main/README.md), and added remark to automaticallt add table of contents to these files upon `yarn fix`.

## Groom issues

I reviewed all issues and PRs and fixed the ones I could, resulting in the Improved Function below. I also installed a Stale action so that issues and PRs will automatically be marked as stale, and then closed if there is no more interest, as to keep a healthy issue board. It's always possible to continue discussing, and then a stale issue won't be closed.

## Improve functions

- `bin2hex`: Add support for multi-byte characters (fixes #427)
- `escapeshellarg`: Add Windows support (fixes #395)
- `file_exists`: Introduced (in #461, thx @erikn69)
- `fmod`: Fix Uncaught RangeError: toFixed() digits argument must be between 0 and 100 (thx @dekairi, fixes #417)
- `strtotime`: Add support oracle dates (fixes #340)
- `unserialize`: Fix fail when serialized array contains (fixes #458, thx @kukawski)
- `var_dump`: Detect circular references (fixes #305)

## Improve testing

It's now possible to write custom tests instead of only writing tests as comments in function headers. For an example see [`src/php/var/serialize.mocha.js`](https://github.com/locutusjs/locutus/blob/main/src/php/var/serialize.mocha.js).

We added `'use strict'` to generated tests to uncover more issues, and we made it clearer which tests are generated from function header comments.

In CI, we now test against Node 20.

## Open Discussion Forum

Check out <https://github.com/locutusjs/locutus/discussions/471> :)

## Concluding

All of these things should make it more enjoyable to hack on Locutus, and enable people to progress the project also when I'm not around, which happens :) Hope you'll like it!
18 changes: 8 additions & 10 deletions website/source/about.md
Expand Up @@ -11,20 +11,18 @@ alias:

> All your standard libraries will be assimilated into our JavaScript collective. Resistance is futile.
Welcome to Locutus, where the boundaries of coding languages blur. We're a dedicated collective of hobbyist developers
and coding enthusiasts on a mission to explore the infinite possibilities of porting standard libraries from various
programming languages into JavaScript. Our journey is one of discovery, innovation, and sometimes, delightful chaos.
Welcome to Locutus, where the boundaries of coding languages blur. We're a dedicated collective developers on a mission
to explore the possibilities of porting standard libraries from various programming language (Go, Ruby, PHP, C) to
JavaScript. Our journey is one of discovery, innovation, and sometimes, delightful chaos.

In the vast expanse of code, we believe that the essence of programming languages can be unified under the banner of
JavaScript. From the complex to the quirky, we assimilate libraries with a spirit of curiosity and a penchant for
experimentation. Our creations range from groundbreaking functions that enhance the JavaScript ecosystem, to unique
oddities that challenge the norms of coding.
From the complex to the quirky, we assimilate libraries with a spirit of curiosity and a penchant for experimentation.
Our creations typically start as rainy Sunday afternoon puzzles, and end up ranging from groundbreaking functions that
enhance the JavaScript ecosystem, to unique oddities that challenge the norms of coding.

As we navigate through this uncharted territory, we invite you to join us. Whether to contribute, learn, or simply
marvel at the wonders of cross-language integration and portability, your presence is valued. With each function we
port, we embrace the unexpected and celebrate the diversity of programming languages.
marvel at the wonders of cross-language integration and portability, your presence on GitHub is valued.

Embark on this journey with us at [Locutus.io](https://locutus.io/).
Embark on this journey with us at [locutus.io](https://locutus.io/).

Use our creations at your own risk, and may they inspire you to push the boundaries of what's possible with JavaScript.

Expand Down
2 changes: 0 additions & 2 deletions website/themes/icarus/layout/common/footer.ejs
Expand Up @@ -2,8 +2,6 @@
<div class="outer">
<div id="footer-info" class="inner">
&copy; 2007-<%= date(new Date(), 'YYYY') %> <%= config.author || config.title %> and <a href="/authors">authors</a>.<br>
Powered by <a href="https://hexo.io/" target="_blank">Hexo</a>.
Theme by <a href="https://github.com/ppoffice">PPOffice</a>.
Arwork by <a href="https://troydodd.deviantart.com/art/Locutus-of-Borg-217586598">Troy Dodd</a>.

</div>
Expand Down
121 changes: 62 additions & 59 deletions website/themes/icarus/layout/function.ejs
Expand Up @@ -10,43 +10,42 @@
</header>

<div class="article-entry">
<p>
<%- page.description %>
</p>

<!-- Code -->
<%- page.content %>

[
<a href="https://github.com/locutusjs/locutus/blob/main/src/<%= page.language %>/<%= page.category %>/<%= page.function %>.js">View on GitHub</a>
|
<a href="https://github.com/locutusjs/locutus/edit/main/src/<%= page.language %>/<%= page.category %>/<%= page.function %>.js">Edit on GitHub</a>
|
<a href="https://raw.githubusercontent.com/locutusjs/locutus/main/src/<%= page.language %>/<%= page.category %>/<%= page.function %>.js">Source on GitHub</a>
]

<div class="clearfix"></div>

<h2>How to use</h2>
<p>
You you can install via <code>npm install locutus</code> and
require it via <code>require('locutus/<%= page.language %>/<%= page.category %>/<%= page.function %>')</code>.
You could also require the <code><%= page.category %></code> module in full
so that you could access <code><%= page.category %>.<%= page.function %></code> instead.
You you can install via <code>yarn add locutus</code> and
require this function via <code>const <%= page.function %> = require('locutus/<%= page.language %>/<%= page.category %>/<%= page.function %>')</code>.
</p>
<p>
If you intend to target the browser, you can then use a module bundler such as
It is important to use a bundler that supports tree-shaking
so that you only ship the functions that you actually use to your browser,
instead of all of Locutus, which is massive. Examples are:
<a href="https://parceljs.org/" target="_blank" rel="external">Parcel</a>,
<a href="https://webpack.github.io/" target="_blank" rel="external">webpack</a>,
<a href="https://browserify.org/" target="_blank" rel="external">Browserify</a>, or
<a href="https://webpack.github.io/" target="_blank" rel="external">webpack</a>, or
<a href="https://rollupjs.org/" target="_blank" rel="external">rollup.js</a>.

This can be important because Locutus allows modern JavaScript in
the source files, meaning it may not work in all browsers without
a build/transpile step. Locutus does transpile all functions to ES5
before publishing to npm.
For server-side use this is typically less of a concern.
</p>

<% if (page.examples.length > 0 ) { %>
<h2>Examples</h2>
<p>
Please note that these examples are distilled from test cases that automatically verify
our functions still work correctly. This could explain some quirky ones.
</p>
<table>
<tr><th>#</th><th>code</th><th>expected result</th></tr>
<%
var cnt = 0;
page.examples.forEach(function(example) {
cnt++
var ret = page.returns[(cnt - 1)]
%>
<tr><td><%= cnt %></td><td><code><%= example %></code></td><td><code><%= ret %></code></td></tr>
<% }) %>
</table>
<% } %>

<% if (page.language === 'php' && page.category === 'array') { %>
<h2>PHP arrays and JavaScript</h2>
<p>
Expand All @@ -62,21 +61,12 @@
<p>
So don't use this for anything serious if you rely on the order to be consistent accross platforms.
</p>
<p>
To influence how Locutus treats objects to arrays, you can check out the `locutus.objectsAsArrays` setting.
</p>
<% } %>
<h2>A community effort</h2>
<p>
Not unlike Wikipedia, Locutus is an ongoing community effort. Our philosophy follows
<a href="https://medium.com/what-i-learned-building/9216e1c9da7d">The McDonald’s Theory</a>.
This means that we don't consider it to be a bad thing that many of
our functions are first iterations, which may still have their
fair share of issues. We hope that these flaws will inspire others to come up with better ideas.
</p>
<p>
This way of working also means that we don't offer any
production guarantees, and recommend to use Locutus inspiration
and learning purposes only.
</p>
<% if (page.notes.length > 0) { %>
<h2>Notes</h2>
<ul>
Expand All @@ -96,25 +86,38 @@
</ul>
<% } %>
<% if (page.examples.length > 0 ) { %>
<h2>Examples</h2>
<p>
Please note that these examples are distilled from test cases that automatically verify
our functions still work correctly. This could explain some quirky ones.
</p>
<p>
<%- page.description %>
</p>
<!-- Code -->
<%- page.content %>
<div class="clearfix"></div>
<h2>A community effort</h2>
<p>
Not unlike Wikipedia, Locutus is an ongoing community effort. Our philosophy follows
<a href="https://medium.com/what-i-learned-building/9216e1c9da7d">The McDonald’s Theory</a>.
This means that we assimilate first iterations with imperfections,
hoping for others to take issue with-and improve them.
This unorthodox approach has worked very well to foster fun and fruitful collaboration,
but please be reminded to use our creations at your own risk.
<code>THE SOFTWARE IS PROVIDED "AS IS"</code> has never been more true than for Locutus.
</p>
<p>
Now go and:
[
<strong><a href="https://github.com/locutusjs/locutus/blob/main/src/<%= page.language %>/<%= page.category %>/<%= page.function %>.js">View on GitHub</a></strong>
|
<strong><a href="https://github.com/locutusjs/locutus/edit/main/src/<%= page.language %>/<%= page.category %>/<%= page.function %>.js">Edit on GitHub</a></strong>
|
<strong><a href="https://raw.githubusercontent.com/locutusjs/locutus/main/src/<%= page.language %>/<%= page.category %>/<%= page.function %>.js">View Raw</a></strong>
]
</p>
<table>
<tr><th>#</th><th>code</th><th>expected result</th></tr>
<%
var cnt = 0;
page.examples.forEach(function(example) {
cnt++
var ret = page.returns[(cnt - 1)]
%>
<tr><td><%= cnt %></td><td><code><%= example %></code></td><td><code><%= ret %></code></td></tr>
<% }) %>
</table>
<% } %>
<hr />
<%- partial('locutus/add_more', {curLang: curLang}) %>
Expand Down
12 changes: 3 additions & 9 deletions website/themes/icarus/layout/locutus/add_more.ejs
@@ -1,25 +1,19 @@
<% if (curLang.language !== 'php') { %>
<%
var cnt = site.pages.find({ language: curLang.language, type: 'function' }).length
var header = 'Ehm.. Only ' + cnt + ' ' + curLang.human + ' function'
var header = 'Ehm.. only ' + cnt + ' ' + curLang.human + ' function'
if (cnt !== 1) {
header += 's'
}
header += ' in all of Locutus?'
header += '?'
if (cnt > 50) {
header = 'Welcoming your addition'
}
%>
<h2><%= header %></h2>
<p>
We could still assimilate many more functions to this language.
We only just <a href="/2016/05/announcing-locutus/">rolled out multilingual support to Locutus</a>.
If you fancy a challenge, we'd love your help
expanding that.
For instance, you could:
We can use your help porting more. Have a rainy Sunday afternoon to spare and a taste for a porting puzzle?
</p>
<ul>
<li>
Expand Down
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit be31bc5

Please sign in to comment.