Curiosity drivenurn:uuid:92f343b7-54a0-4c51-9a9a-b3c6d9421c572015-07-10T16:20:01Zhttps://curiosity-driven.org/assets/8aa8f9ae/icon-192.pngContent of this page is licensed under the Creative Commons Attribution 3.0 License. Code samples are licensed under the Apache 2.0 License.https://curiosity-driven.org/assets/8aa8f9ae/icon-192.png#495C40WebCrypto zero-trust lotteryurn:uuid:69b86bfb-b2a3-422c-b0b0-409a516be2b82015-09-09T16:20:01Z2015-09-09T16:20:01ZBrowsers that implement the WebCrypto API can be used to conduct a truly zero-trust, secure lottery in less than 200 lines of modern JavaScript code.Curiosity driven6Push notificationsurn:uuid:ea2fcda9-31df-4e2c-a891-9971e7a923232015-07-10T16:20:01Z2015-07-10T16:20:01ZPush API combined with Notifications API allows displaying notifications about background events that happen even when the web page is closed.Curiosity driven5Reactive WebRTC conferenceurn:uuid:ad3fc4c9-55d2-46bc-bc3a-895fd60e966e2015-05-29T16:20:01Z2015-05-29T16:20:01ZWebRTC can be used to build a plugin-free video conference with screensharing in pure JavaScript. Observables — proposed for ES7 — let application logic be expressed in a clean, functional and composable way.Curiosity driven11Continuationsurn:uuid:3f393cea-f0ad-45b8-a59c-3db39ecfe5ac2014-10-31T01:20:01Z2014-10-31T01:20:01ZThere is one abstraction that can be used to implement such apparently diverse concepts as exceptions, generators, coroutines and even the backtracking mechanism present in Prolog.Curiosity driven19Array slices and membranes using ES6 proxiesurn:uuid:8e3cfcf3-166b-4e29-a986-63df3e2e0a972014-08-30T16:20:01Z2014-08-30T16:20:01ZJavaScript’s dynamic nature, first-class functions and prototypes could always be used for elegant metaprogramming. Proxies let programmers further blur the line between the native, user defined objects and the host objects.Curiosity driven8Low-level Bitcoinurn:uuid:6c1a0815-c625-47c0-9d63-20aea0a338f22014-08-21T19:47:01Z2014-07-13T16:20:01ZExploring Bitcoin can yield interesting surprises. The block chain already contains various gems hidden inside transactions — tributes, illegal data, even pictures and a patch fixing bug in a Bitcoin client.Curiosity driven17Bitcoin contractsurn:uuid:37e1c524-8392-44f5-8534-85e6e230f9262014-07-12T16:20:01Z2014-07-12T16:20:01ZBitcoin is designed to support a wide variety of transaction types. Although currently the majority of transactions are standard payments to address it is possible to build more complex protocols.Curiosity driven11Minimal AMD loaderurn:uuid:db3d819f-f19c-4268-ae9f-c4447f5f48742014-05-09T16:20:01Z2014-05-09T16:20:01ZAMD simplifies modularizing JavaScript applications but as it is not a browser built-in mechanism a loader library is still needed to bootstrap the process. Fortunately it is possible to write a loader that supports plugins in less than 850 characters of optimized code.Curiosity driven8<code-block> Web Componenturn:uuid:88468ef7-56c4-4b87-bfd1-4c20ebe3c0192014-07-12T18:28:01Z2014-04-04T23:20:01ZJavaScript widgets are traditionally built using <div> soup and a mixture of framework-specific scripts. Web Components aim to change the status quo by introducing standard way of building elements.Curiosity driven3Pi approximation using Monte Carlo methodurn:uuid:87e24b8d-d2de-4270-ac49-7f0a9cbe697b2014-03-14T15:26:53Z2014-03-14T15:26:53ZMonte Carlo is a method to solving problems that uses random inputs to examine the domain. Pi approximation is a simple example that illustrates an idea of how the Monte Carlo method works.Curiosity driven2Solving riddles with Prolog and ES6 generatorsurn:uuid:2a6a3fef-5942-4be4-af0f-303743fe7dc82014-08-31T14:24:02Z2014-03-10T16:20:02ZGenerators and backtracking can be used to build a simple Prolog interpreter in less than 160 lines of JavaScript. It will tell us facts about the Forrester family and even solve the Einstein’s puzzle.Curiosity driven11Data binding with Object.observeurn:uuid:7b316c64-d940-47e7-aa7c-d32ba88d058a2014-07-12T18:49:02Z2014-02-20T20:33:02ZTwo-way data binding greatly simplifies writing views in web applications. The code in this article uses Object.observe to implement a simple two-way data binding in about 100 lines of code.Curiosity driven4Monads in JavaScripturn:uuid:dffdd7ca-6e0a-4dab-9b62-f99f5031534e2015-06-07T15:36:02Z2014-02-13T20:33:02ZMonad is a design pattern used to describe computations as a series of steps. They are extensively used in pure functional programming languages to manage side effects but can also be used in multiparadigm languages to control complexity.Curiosity driven7Sudoku solverurn:uuid:78611db0-8f6b-11e3-baa8-0800200c9a662014-02-06T16:20:02Z2014-02-06T16:20:02ZSolving sudoku using the backtracking algorithm. Uses ES6 generators to create a stream of possible solutions.Curiosity driven3Private properties in JavaScripturn:uuid:9f867c90-8dcd-11e3-baa8-0800200c9a662014-02-25T18:44:02Z2014-02-04T16:20:02ZObject properties were traditionally left unprotected in JavaScript or hidden, captured in a closure. Symbols and WeakMaps provide another alternative.Curiosity driven5Generating primes in ES6urn:uuid:69700799-fdc3-4e67-84bd-7aefe07431592014-02-08T11:50:02Z2014-01-30T16:20:02ZGenerators can be used to represent infinite streams of values. The algorithm used below is the Sieve of Eratosthenes. for-of loops are used to iterate over values returned from the generator.Curiosity driven1Easy asynchrony with ES6urn:uuid:5a372be2-3e87-4ccb-bee4-c5dfe4f14ead2014-08-20T18:36:02Z2014-01-22T16:20:02ZPromises and generators can be used together to describe complex asynchronous flow in a simple, synchronous way.Curiosity driven5Simple AMD loader in 30 lines of codeurn:uuid:64065030-8b40-11e3-baa8-0800200c9a662014-01-22T16:20:01Z2014-01-22T16:20:01ZSimple AMD loader that uses native Promises to do the heavy lifting.Curiosity driven1