Skip to content

Instantly share code, notes, and snippets.

View KanagawaMarcos's full-sized avatar
:octocat:
F#, NixOS & Postgres

Kanagawa Marcos KanagawaMarcos

:octocat:
F#, NixOS & Postgres
View GitHub Profile
@jkone27
jkone27 / fsharpOnionArch.fsx
Last active October 14, 2023 21:38
F# Onion Architecture
open System
open System.Threading.Tasks
module Domain =
type Order = { Number: string; Price: decimal; Type: string }
let changePrice order price =
{ order with Price = price }
@akhansari
akhansari / onion-1.fs
Last active February 22, 2023 16:51
F# : Onion architecture in a nutshell
// 1. pure, don't think about IO at all
module Domain =
let add x y = x + y
// 2. think about IO but not its implementation
module App =
let add (getX: unit -> Async<int32>) y =
async {
let! x = getX ()
return Domain.add x y
@sapegin
sapegin / bad.js
Last active May 19, 2020 17:51
Common Testing Library antipatterns
import { render } from "@testing-library/react";
import { MyComponent } from './MyComponent';
describe("MyComponent", () => {
let wrapper;
beforeEach(async () => {
wrapper = render(<MyComponent butiful />);
});
@rougier
rougier / clean.el
Created May 10, 2020 02:43
A very minimal but elegant emacs configuration file
(require 'org)
(setq-default indent-tabs-mode nil)
(setq org-display-inline-images t)
(setq org-redisplay-inline-images t)
(setq org-startup-with-inline-images "inlineimages")
(setq default-frame-alist
(append (list '(width . 72) '(height . 40))))

Desafio Técnico-Elixir

Precisamos de pessoas com energia, integridade e inteligência, que aprendam rápido e que gostem de conhecer e aplicar novas tecnologias.

O tempo sugerido para conclusão do desafio é de 15 dias. Queremos que você se dedique e demonstre a qualidade de seu código.

Bom desafio!

O Desafio

O Sistema Financeiro precisa representar valores monetários. A ideia básica é ter uma estrutura de dados que permita realizar operações financeiras com dinheiro dentro de uma mesma moeda. Isso é pelo motivo de pontos flutuantes terem problemas de aritmética, logo encodificamos valores decimais/fracionais/reais como uma estrutura de dados com campos em inteiros, além de mapeamos operações aritméticas sobre tal estrutura. No fim, a implementação acaba sendo uma Estrutura de Dados Abstrata.

@swlaschin
swlaschin / effective-fsharp.md
Last active March 8, 2024 03:10
Effective F#, tips and tricks

Architecture

  • Use Onion architecture

    • Dependencies go inwards. That is, the Core domain doesn't know about outside layers
  • Use pipeline model to implement workflows/use-cases/stories

    • Business logic makes decisions
    • IO does storage with minimal logic
    • Keep Business logic and IO separate
  • Keep IO at edges

@kauffmanes
kauffmanes / install_anaconda.md
Last active May 12, 2024 15:36
Install Anaconda on Windows Subsystem for Linux (WSL)

Thanks everyone for commenting/contributing! I made this in college for a class and I no longer really use the technology. I encourage you all to help each other, but I probably won't be answering questions anymore.

This article is also on my blog: https://emilykauffman.com/blog/install-anaconda-on-wsl

Note: $ denotes the start of a command. Don't actually type this.

Steps to Install Anaconda on Windows Ubuntu Terminal

  1. Install WSL (Ubuntu for Windows - can be found in Windows Store). I recommend the latest version (I'm using 18.04) because there are some bugs they worked out during 14/16 (microsoft/WSL#785)
  2. Go to https://repo.continuum.io/archive to find the list of Anaconda releases
  3. Select the release you want. I have a 64-bit computer, so I chose the latest release ending in x86_64.sh. If I had a 32-bit computer, I'd select the x86.sh version. If you accidentally try to install the wrong one, you'll get a warning in the terminal. I chose `Anaconda3-5.2.0-Li
@JCMais
JCMais / react-native-svg.js
Last active August 1, 2023 00:12
React Native SVG mock to be used with jest, put in __mocks__ dir in the src dir.
// @flow
// https://github.com/FormidableLabs/react-native-svg-mock
import React from 'react';
const createComponent = function(name: string) {
return class extends React.Component {
// overwrite the displayName, since this is a class created dynamically
static displayName = name;
class RedBlackTree:
#Red/Black tree implementation based on
#Algorithms in C++, Sedgewick
#Introduction To Algorithms Cormen, Thomas H. / Leiserson, Charles E . / Rivest, Ronald L . The MIT Press 07/1990
# NOTE : LOOK AT END OF FILE TO SEE DIFFERENCES IN TRAVERSAL IDIOMS
red,black = range(2)
# double underscores induce name mangling to make methods private
def __copy(self,node):