Skip to content

Instantly share code, notes, and snippets.

View sporto's full-sized avatar

Sebastian Porto sporto

  • Melbourne, Australia
View GitHub Profile
@sporto
sporto / 1-introduction.md
Last active November 17, 2024 14:52
CanJS: Communication between components

Introduction

The intention of this document is to explore patterns of communication between can components and discuss possible improvements and newer patterns.

We should aim for:

  • Making common scenarios easier
  • Establishing best practices and canonical patterns
  • Having as little surprise as possible, it should be clear from looking at the code exactly what the intention is
  • Aligning with future standards, specifically try to align with web components as much as possible
@sporto
sporto / how-to-use-react-inside-elm.md
Last active April 4, 2024 14:54
Using React inside Elm

Register Element

First you will need document-register-element

yarn add document-register-element

Add script to register elements

@sporto
sporto / Cost.fsx
Created December 17, 2021 02:08
Get stats from cost page usage
#r "nuget: FSharp.Data,4.2.6"
#r "nuget: FSharpPlus,1.2.2"
#r "nuget: FSharp.Stats, 0.4.2"
open FSharp.Data
open FSharpPlus
open System.Web
open System
open FSharp.Stats
@sporto
sporto / clipboard.history.json
Last active August 27, 2021 03:58
Visual Studio Code Settings Sync Gist
{
"version": 2,
"clips": [
{
"value": " {{ collection.pages }}",
"createdAt": 1630036485337,
"copyCount": 1,
"useCount": 0,
"language": "html",
"createdLocation": {
@sporto
sporto / gist:9a35f5caa1184807ea9d12412fcadac7
Created January 19, 2021 01:09
Output VSCode Elm LS 2
[Trace - 11:59:50 am] Sending request 'initialize - (0)'.
Params: {
"processId": 453470,
"clientInfo": {
"name": "Visual Studio Code",
"version": "1.52.1"
},
"locale": "en-gb",
"rootPath": "/home/sebastian/Source/staxio/stax",
"rootUri": "file:///home/sebastian/Source/staxio/stax",
@sporto
sporto / Download.elm
Created November 8, 2020 21:14
Download a file in Elm
module Main exposing (main)
import Browser
import Bytes exposing (Bytes)
import File.Download as Download
import Html exposing (Html, button, div, text)
import Html.Events exposing (onClick)
import Http
@sporto
sporto / description.md
Last active May 13, 2020 23:32
Back to issue

The problem

There are several pages in our app where users arrive from different places.

e.g. Page A -> Page C Page B -> Page C

In Page C we want to show a link back to the previous page. E.g.

@sporto
sporto / replace.nim
Created April 21, 2020 22:22
Replace text in files
# nim c -r ./scripts/replace.nim ./replacements.csv
import strutils, sequtils, os, sugar
proc split_line(line: string): seq[string] =
line.split("|")
proc get_replacements(filename: string): seq[seq[string]] =
filename
.readFile()
@sporto
sporto / client.go
Last active December 10, 2019 16:58
Concurrency: JavaScript vs Go
package main
import (
"fmt"
"io/ioutil"
"net/http"
"os"
"time"
)
@sporto
sporto / QuickChart URL
Last active October 1, 2019 22:20
QuickChart
https://quickchart.io/chart?bkg=white&c=%2F%2F%20Edit%20me!%0A%7B%0A%20%20type%3A%20%27bar%27%2C%0A%20%20%20options%3A%20%7B%0A%20%20%20%20legend%3A%20%7B%0A%20%20%20%20%20%20position%3A%20%27bottom%27%2C%0A%20%20%20%20%20%20labels%3A%20%7B%0A%20%20%20%20%20%20%20%20boxWidth%3A%2012%2C%0A%20%20%20%20%20%20%20%20padding%3A%2020%2C%0A%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%7D%2C%0A%20%20%20%09scales%3A%20%7B%0A%20%20%20%20%09xAxes%3A%20%5B%0A%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20stacked%3A%20true%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20gridLines%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20offsetGridLines%3A%20false%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20drawOnChartArea%3A%20false%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20%20%20%20%20ticks%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20fontSize%3A%2014%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20maxTicksLimit%3A%205%2C%0A%20%2