Skip to content

Instantly share code, notes, and snippets.

View HenriqueLimas's full-sized avatar

Henrique Limas HenriqueLimas

View GitHub Profile
import { define } from "osagai";
import { on } from "osagai/events";
import { update } from "osagai/dom";
function Todos({ element, query }) {
on("click", query(".btn"), () => {
update(element, (items = []) => {
items.push({
name: `Item nr ${items.length + 1}`
});
import { define } from 'osagai'
import { on } from 'osagai/events'
function FancyButton({ query }) {
on('click', query('.btn'), () => {
console.log('Clicked')
})
return () => '<button class="btn">Click me</button>'
}
import { define } from "osagai";
function HelloComponent() {
return () => "<div>Hello</div>";
}
define("hello-world", HelloComponent);

Slides PWA

Intro (What, why, how) -> Reliable (Databases, Always available) -> Fast () -> engajable

Web vs Native

13% web vs 87% App 80% of time spent is in users top 3 apps

Native app to open is fast and work offline and has push notification. Web is reacher than native apps

PWA

A lot of people think that native web its best than web

PWA they combine the best of the web with the best of the app

  • reliable (low connection)
  • fast (animation)
  • engagable (notificaiton, home screen)

Caching strategies

Currying

Ramda and lodash/fp already curry a lot of functions.

Currying: if you know the function is curried, ex the docs say that a function has 3 arguments, if you execute the first time with one argument, it will return a new function.

Compose

Functions can "meld" aka compose. If we have functions f, g and h.

  • Zooming way out from code

Functional Javascript

Soul of Functional Programming: Separation and Recognition

  • Anything goes
  • Everything changes
  • Weird names

The symptoms

Testing and modular front-end

assert

Its inside the node core. This are things that we wanna test.

  • assert.ok
  • assert.equal
  • assert.deepEqaul()
  • assert.notOk()
  • assert.notEqual()

leveldb

am e,bedded key/value database. Is good to be a modular database. If you wanna run applications on browser as well as in node.

its embedded it is in the same process. It lives in the program. It was built for chrome.

install

Since leveldb is a standalone database, you can install it with npm:

Networking-streams

servers and clients

Any networked computer can be a server Any networked computer can be a client

Package a put in a little pieces.

tc vs udp

TCP - reliable transport: has ACK