Skip to content

Instantly share code, notes, and snippets.

View carlfredrikhero's full-sized avatar

Carl-Fredrik Herö carlfredrikhero

View GitHub Profile
type Company isAuthorized = Company Internals
authorize :: Accessor -> Company Unauthorized -> Either AuthorizationError (Company Authorized)
type Authorized = Authorized
type UnAuthorized = UnAuthorized
id :: Company isAuthorized -> Id Id.Company
id (Company internals) =
{
"sample":
{
"description":"SE-image",
"image-url":"//www.specialelektronik.se/images/allman_kurser_1280x720.jpg"
}
}
...
import SE.UI.Colors as Colors
...
filledBox : Colors.Hsla -> Html msg
filledBox color =
styled Html.Styled.div
[ Css.backgroundColor (color |> Colors.toCss)
, Css.color (color |> Colors.invert |> Colors.toCss)
, Css.hover
@carlfredrikhero
carlfredrikhero / mapLightness.elm
Last active May 4, 2021 21:45
Map lightness in Colors.elm
-- Every internal value has a mapping function like this:
{-| Change lightness of the color
-}
mapLightness : (Float -> Float) -> Hsla -> Hsla
mapLightness f (Hsla hue saturation lightness alpha) =
Hsla hue saturation (f lightness) alpha
-- Two helpers for very common situations
@carlfredrikhero
carlfredrikhero / HSLA.elm
Last active May 4, 2021 21:36
HSL(A) Type in elm
{-| The internal type is an opaque type but we expose helper functions for each colors and mapping functions for each value.
-}
type Hsla
= Hsla Hue Saturation Lightness Alpha
{-| Each defined color is exposed as another custom type, to enable easy pattern matching.
It's useful in configurations for example.
-}
type Color
= White
button : List Modifier -> Maybe msg -> List (Html msg) -> Html msg
SE.UI.Buttons.button
[ Buttons.Size Control.Medium
, Buttons.Color Colors.Buy
]
(Just ClickedButton)
[ Icon.cart Control.Regular, Html.text "Add to cart" ]
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
/*
* DROPDOWNS
*/
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<p>Edge will crash on focus of this element<br>
<input type="date" max="2915-01-01"></p>
@carlfredrikhero
carlfredrikhero / runjob.vbs
Last active April 22, 2016 13:55
Qlikview macro to trigger "on demand" loads of NPrinting job or task
' Read https://community.qlik.com/docs/DOC-8441 to set up "External XML Request"
' in NPrinting
' Add this macro to Qlikview, change the Path variable
' Make sure "Request Module Security" = "System Access" and
' "Current Local Security" = "Allow System Access"
' http://i.imgur.com/lKlUNt2.png
' If you need to execute this macro from the Access Point, be sure to allow
' macros on the server. http://i.imgur.com/xerNPnF.png
@carlfredrikhero
carlfredrikhero / chained.js
Last active April 16, 2016 05:41
Fetch product from podio, write to file, confirm with a comment in Podio that the product has been saved successfully
// Fetch product from podio, write to file, confirm with a comment in Podio that the product has been saved successfully
// Initiate the product
var product = Product({
path: config.data_path,
podio: podio,
item_id: data.item_id,
fields: config.podio.products.fields
});
product.fetch()