Skip to content

Instantly share code, notes, and snippets.

View ultrox's full-sized avatar
🏠
Working from home

Marko Vujanic ultrox

🏠
Working from home
View GitHub Profile
@ultrox
ultrox / example.ts
Last active December 7, 2023 08:39
Can't seams to alight the types when folding the port. My expectation is for port to be number, which it is, but I'm getting an error telling me it can't be assigned to Error.
View example.ts
import type { PathLike } from "fs";
import fs from "fs";
import path, { parse } from "path";
import * as E from "fp-ts/lib/Either";
import { pipe } from "fp-ts/function";
import { object } from "firebase-functions/v1/storage";
import { objectHasProp } from "~/lib/utils";
import * as IE from "fp-ts/IOEither";
main();
@ultrox
ultrox / quiz_postgres.sql
Created October 14, 2023 10:29
quiiz_dupm_Learning_SQL_programing.postgres.sql
View quiz_postgres.sql
-- This is from https://www.linkedin.com/learning/learning-sql-programming-8382385/
-- There where no postgres so I adjusted it to work strait up.
CREATE TABLE states (
state_name VARCHAR(50),
state_abbrev CHAR(2),
region VARCHAR(50),
division VARCHAR(50)
);
@ultrox
ultrox / ExpectJson.elm
Last active August 9, 2023 22:29
How expectJson function works in Elm
View ExpectJson.elm
{-
I got frustrated about how Http.get works, so I expanded all the function in Elm core to get to the bottom of line
-}
expectJson : (Result Error a -> msg) -> Decode.Decoder a -> Expect msg
expectJson toMsg decoder =
let
decodingResult string =
case (Decode.decodeString decoder string) of
Ok v ->
Ok v
@ultrox
ultrox / Main.elm
Last active August 9, 2023 20:32
Elm 0.19.1 + RemoteData. How to use RemoteDetails talk from Kris Jenkins - Slaying a UI antypattern
View Main.elm
module Main exposing (..)
-- This code needs following dependencies:
-- elm/browser 1.0.2
-- elm/html 1.0.0
-- elm/http 2.0.0
-- elm/json 1.1.3
-- elm/random 1.0.0
-- krisajenkins/remotedata 6.0.1
-- NoRedInk/elm-json-decode-pipeline/ 1.0.1
-- Can try it here: https://ellie-app.com/nBCdHpv2jRta1
@ultrox
ultrox / Main.elm
Created July 29, 2023 09:11 — forked from s-m-i-t-a/Main.elm
How to update nested fields in record
View Main.elm
module Main exposing (..)
type alias Bar =
{ baz : String }
type alias Foo =
{ bar : Bar }
@ultrox
ultrox / work.md
Last active July 27, 2023 12:33
Some of the work
View gist:14cb91841f2558b770a476b44307eed6
import { createFactory, Component } from 'react'
export const withContext = (childContextTypes, getChildContext) => BaseComponent => {
const factory = createFactory(BaseComponent)
class WithContext extends Component {
getChildContext = () => getChildContext(this.props)
render() {
return factory(this.props)
}
@ultrox
ultrox / download-roc.md
Last active October 1, 2022 16:15
Download Latest Roc
View download-roc.md

Roc installation guide for x86 Linux systems

How to install Roc

Note: In order to develop in Roc, you need to install the Roc CLI, which includes the Roc compiler and various helpful utilities.

  1. Download Latest nightly Roc (find assets here)

Or use jq and curl for seamless copy/paste

@ultrox
ultrox / download-roc.sh
Created September 23, 2022 22:34
Download Latest Roc
View download-roc.sh
curl -s https://api.github.com/repos/roc-lang/roc/releases|jq -r '.[0].assets [0].browser_download_url'|xargs -n1 -I % curl -L % --output roc_nightly.tar.gz
@ultrox
ultrox / tmux_italic.md
Created September 6, 2022 22:40 — forked from gyribeiro/tmux_italic.md
enable italic font on tmux
View tmux_italic.md