Friday, January 03, 2025

GitHub Actions => NPM

 Publishing a simple client-side JavaScript package to npm with GitHub Actions | Simon Willison’s TILs

.github/workflows/publish.yml:

name: Publish Package to npmjs
on:
  release:
    types: [published]
jobs:
  build:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      id-token: write
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: '20.x'
          registry-url: 'https://registry.npmjs.org'
      - run: npm publish --provenance --access public
        env:
          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}


Thursday, January 02, 2025

2025: a square number year

 7 Beautiful Patterns Behind The Unique Mathematical Year 2025! - YouTube

(20 + 25)2 = 45² = 2025


2025 is also divisible with sum of its digits
 (2+0+2+5)
²  * 5² = 92  52= 81 * 25 = 2025 

(1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9)² 45² = 2025

13 + 23 + 33 + 43 + 53 + 63 + 73 + 83 + 93 2025  

2025 is also sum of first 45 odd numbers
1 + 3 + 5 + ... 89 = 2025

and a sum of "multiplication table" 1-9 x 1-9

2025 is a Very Mathematical Year. The Numerous Hidden Properties of This… | by Paolo Molignini, PhD | Puzzle Sphere | Jan, 2025 | Medium

const { log: print } = console // JavaScript, to make compatible with Python syntax
print((20 + 25) ** 2)
> 2025
print(9 ** 2 * 5 ** 2)
> 2025
// # 2005 can be divided by sum its digits print((2+0+2+5) ** 2 * 5 ** 2) > 2025

// # 2005 is square of sum of first 9 numbers
print((1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9) ** 2)
> 2025

// # 2005 is sum of cubes of first 9 numbers

print
(1 ** 3 + 2 ** 3 + 3 ** 3 + 4 ** 3 + 5 ** 3 + 6 ** 3 + 7 ** 3 + 8 ** 3 + 9 ** 3)
> 2025
// # 2005 is sum of first 45 odd numbers
let sum1 = 0
for(let i = 1, j = 1; i <= 45; i+=1, j+=2) sum1 += j
print(sum1)
> 2025 // same, more compact, less readable, JavaScript console.log([...Array(45)].reduce((sum, _, i) => sum + (i * 2 + 1), 0));

// one line python code print(sum(range(1, 90, 2)))
// # 2005 is sum of multiplication table of 1-9 * 1-9
let sum2 = 0
for(let i = 1; i <= 9; i++)
for(let j = 1; j <= 9; j++)
sum2 += i * j
print(sum2) > 2025 // one-line python code
print(sum(i * j for i in range(1, 10) for j in range(1, 10)))


Also: 2025
"Number of ways you can hit 4 different numbers on a dart board with 2 being even and 2 being odd"
Thansks  Bill Mather!


E = total even numbers on dart board = 10
O = total odd numbers on dart board = 10

AI solution (both Google and ChatGPT)
  • The number of ways to choose 2 even numbers from EE is:

    (E2)=E(E1)2\binom{E}{2} = \frac{E(E-1)}{2}= 10 * 9 / 2 = 45

    The number of ways to choose 2 odd numbers from OO is:

    (O2)=O(O1)2\binom{O}{2} = \frac{O(O-1)}{2}
    = 10 * 9 / 2 = 45

Since we want 2 even numbers and 2 odd numbers, the total number of ways is:

Total ways=(E2)(O2)\text{Total ways} = \binom{E}{2} \cdot \binom{O}{2}
45 * 45 = 2025



Boa: JavaScript in Rust

Boa v0.20: An Alternative JavaScript Compiler 

Under development for several years, Boa has a few missions: be a Rust ECMAScript implementation, be easy to embed in Rust projects, and be a fast, safe JS engine overall. v0.20 sees a bump up to 89.92% compliance in the Test262 suite, improves Temporal support, adds Atomics.pause, and more. This is no toy engine.

JavaScript Weekly Issue 716: December 12, 2024



Wednesday, January 01, 2025

AI: next web browser?

Happy New Year! 2025 @DeepLearning.AI

Happy sum(i**3 for i in range(10)) ! (Python)

JavaScript: `H
appy ${Array.from({ length: 10 }, (_, i) => i ** 3).reduce((a, b) => a + b, 0)} !`


Microsoft’s Mustafa Suleyman on what the industry is getting wrong about AGI - The Verge

Microsoft AI chief Mustafa Suleyman says conversational AI is the next web browser

The company’s new AI chief on working for Microsoft, the OpenAI relationship, and when superintelligence might actually arrive

forwardfuture.ai
  • Suleyman sees conversational AI as the "new web browser," integrating with products like Bing, Copilot, and Edge to redefine web experiences.
  • Suleyman contrasted his time at Google with his current role at Microsoft, highlighting Microsoft's focused and collaborative approach under Satya Nadella.
  • While OpenAI's Sam Altman is bullish on achieving AGI with current hardware, Suleyman is more conservative, suggesting a longer timeline and cautioning against equating AGI with superintelligence.


The company behind Arc is building a new AI web browser called Dia



Chrome AI


Chrome: enable experimental "Prompt API for Gemini Nano"

Built-in AI  |  AI on Chrome  |  Chrome for Developers