Skip to content

Instantly share code, notes, and snippets.

Maximilian Hoffmann maxhoffmann

Block or report user

Report or block maxhoffmann

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@maxhoffmann
maxhoffmann / component-based-css-architecture.md
Last active Apr 28, 2019
Component based CSS Architecture
View component-based-css-architecture.md

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 Dec 22, 2017
Signed Api Request Effect Manager
View Manager.elm
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)
View clicks.js
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 / TokenRequest.elm
Last active May 30, 2017
Elm effect manager that handles token authentication
View TokenRequest.elm
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 Jun 1, 2016
Effect Manager for token authentication in Elm
View Api.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 Feb 8, 2018
Token HTTP Authentication in Elm
View Main.elm
import Html.App as Html
import Html exposing (..)
import Html.Events exposing (..)
import Task
import Http
import Json.Decode as Json exposing ((:=))
-- Model
You can’t perform that action at this time.