Skip to content

Instantly share code, notes, and snippets.

View crawftv's full-sized avatar
🎯
Focusing

Crawford Collins crawftv

🎯
Focusing
View GitHub Profile
module Main exposing (main)
import Browser
import Html exposing (Html, button, div, text)
import Html.Attributes exposing (style)
import Html.Events exposing (onClick)
type alias Model =
{
view : Model -> Html Msg
view model =
case model.selectedGender of
Just x ->
case x of
Masculine ->
div [] [
div []
[ button [onClick (SelectGender Masculine), style "background-color" "blue"] [text "Masculine"]
, button [onClick (SelectGender Feminine)] [text "Feminine"]
view : Model -> Html Msg
view model =
case model.selectedGender of
Just Masculine ->
div []
[ button [onClick (SelectGender Masculine), style "background-color" "blue"] [text "Masculine"]
, button [onClick (SelectGender Feminine)] [text "Feminine"]
, button [onClick (SelectGender Neuter)] [text "Neuter"]
,div [] [text (Debug.toString model)]
]
@crawftv
crawftv / RethinkingMaybe1.elm
Created January 21, 2022 04:43
code for article
module Main exposing (main)
import Browser
import Html exposing (Html, button, div, text)
import Html.Attributes exposing (style)
import Html.Events exposing (onClick)
import Debug
type alias Model =
@crawftv
crawftv / requirements.in
Created April 26, 2020 02:30
requirements.in
scikit-learn
pandas
numpy
pyod
category-encoders
pytest
pytest-black
coverage
pytest-coverage
feather-format
@crawftv
crawftv / accidental_recursion.py
Created December 26, 2019 22:55
accidental_recursion.py
#BAD
def f1(input_1,input_2):
obj(input_1, input_2).save()
f1(input_2,input1)
f1(a,b)
#NOT Bad
def f(input_1,input_2):
obj(input_1,input_2).save()
f(input_1,input_2)
@crawftv
crawftv / test_charts.py
Created November 5, 2019 06:09
The test suite for test_charts.py
import pytest
import IPython
from IPython.display import display, HTML
from crawto.charts.charts import Plot, ScatterChart, BarChart, LineChart, Chart_type
from hypothesis import given
from hypothesis.strategies import text, builds, iterables, floats, one_of, integers,composite
class TestChart:
@composite
@crawftv
crawftv / default_codecov.yml
Created October 2, 2019 17:05
The default file for generating codecov reports.
codecov:
notify:
require_ci_to_pass: yes
coverage:
precision: 2
round: down
range: "70...100"
status:
@crawftv
crawftv / basic_config.yml
Created October 2, 2019 17:04
A basic config.yml that works for CircleCI
# Python CircleCI 2.0 configuration file
version: 2
orbs:
codecov: codecov/codecov@1.0.2
jobs:
build:
docker:
- image: circleci/python:3.6
working_directory: ~/repo
import numpy as np
X = np.array([[0,0,1],[0,1,1],[1,0,1],[0,1,0],[1,0,0],[1,1,1],[0,0,0]])
y = np.array([[0],[1],[1],[1],[1],[0],[0]])
def sigmoid(s):
return 1/1+np.exp(-s)
def sigmoid_prime(z):
"""Derivative of the sigmoid function."""