Skip to content

Instantly share code, notes, and snippets.

View maxhoffmann's full-sized avatar
👷‍♂️
currently building konsens.it

Max Hoffmann maxhoffmann

👷‍♂️
currently building konsens.it
View GitHub Profile
@maxhoffmann
maxhoffmann / component-based-css-architecture.md
Last active December 6, 2022 16:56
Component based CSS Architecture

Component based CSS Architecture

Rules

  1. A component always consists of CSS and HTML (JS is optional)
  2. HTML and JS of a component are located in ComponentName.js
  3. Styles of a component are located in ComponentName.scss
  4. Each CSS class starts with the unique component name
  5. The HTML of each component only uses its own prefixed classes
  6. Components can use other components, but never overwrite their styles
@maxhoffmann
maxhoffmann / Manager.elm
Last active December 22, 2017 13:19
Signed Api Request Effect Manager
effect module Api.Manager where { command = MyCmd } exposing (request)
import Task exposing (..)
import Http
import Process
import Json.Decode as Json exposing (field)
import Native.Api
import Json.Decode as Json
import Time exposing (Time)
@maxhoffmann
maxhoffmann / clicks.js
Last active December 7, 2016 17:08
buzz API
import buzz from '@maxhoffmann/buzz';
function clicks(broadcast) {
window.addEventListener('click', broadcast('click'));
}
const logger = () => console.log;
const services = [logger, clicks];
buzz(services);
@maxhoffmann
maxhoffmann / esnextbin.md
Last active December 7, 2016 16:58
esnextbin sketch
@maxhoffmann
maxhoffmann / esnextbin.md
Created December 7, 2016 16:48
esnextbin sketch
@maxhoffmann
maxhoffmann / esnextbin.md
Created December 6, 2016 23:07
esnextbin sketch
@maxhoffmann
maxhoffmann / esnextbin.md
Last active November 23, 2016 15:40
esnextbin sketch
@maxhoffmann
maxhoffmann / TokenRequest.elm
Last active October 9, 2020 14:40
Elm effect manager that handles token authentication
effect module TokenRequest where { command = MyCmd } exposing (request)
import Task exposing (..)
import Http
import Process
import Json.Decode as Json exposing ((:=))
import Native.Api
import Json.Decode as Json
import Time exposing (Time)
@maxhoffmann
maxhoffmann / Api.elm
Created June 1, 2016 09:23
Effect Manager for token authentication in Elm
-- Api Effect Manager
effect module Api where { command = MyCmd } exposing (request, Response)
import Task exposing (..)
import Http
import Process
import Json.Decode as Json exposing ((:=))
import Native.Api
@maxhoffmann
maxhoffmann / Main.elm
Last active February 8, 2018 23:57
Token HTTP Authentication in Elm
import Html.App as Html
import Html exposing (..)
import Html.Events exposing (..)
import Task
import Http
import Json.Decode as Json exposing ((:=))
-- Model