Skip to content

Instantly share code, notes, and snippets.

@ni-ko-o-kin
ni-ko-o-kin / Mein.elm
Created Mar 11, 2020
Phantom Builder Pattern with Elm
View Mein.elm
module Main exposing (main, view)
import Browser
import Html exposing (Html, button, div, text)
import Html.Attributes exposing (style)
main =
Browser.sandbox
{ init = ()
View config.el
;;; package -- summary
;;; .doom.d/config.el -*- lexical-binding: t; -*-
;;; commentary:
;;; code:
;;; basics
(setq doom-font (font-spec :family "Source Code Pro" :size 16))
(setq treemacs-show-hidden-files nil)
(setq-default frame-title-format '((:eval default-directory)))
View Main.elm
port module Main exposing (main)
import Json.Decode as D exposing (Decoder, Value)
import Json.Encode as E
import Platform exposing (worker)
type Msg
= Run Value
View coc-settings.json
{
"codeLens.enable": true,
"coc.preferences.formatOnSaveFiletypes": ["elm", "javascript"],
"coc.preferences.hoverTarget": "float",
"languageserver": {
"elmLS": {
"command": "elm-language-server",
"filetypes": ["elm"],
"rootPatterns": ["elm.json"],
"initializationOptions": {
View .vimrc
call plug#begin('~/.vim/plugged')
"common
Plug 'tpope/vim-surround'
Plug 'itchyny/lightline.vim'
Plug 'neoclide/coc.nvim', { 'branch': 'release' }
Plug 'lifepillar/vim-solarized8'
Plug 'scrooloose/nerdtree'
Plug 'scrooloose/nerdcommenter'
@ni-ko-o-kin
ni-ko-o-kin / Main.elm
Last active Dec 8, 2019
elm-find-by-type-and-value
View Main.elm
module Main exposing (main)
import Browser
import Html exposing (Html, div, text)
type alias Model =
{}
View elm-main.js
(function(scope){
'use strict';
function F(arity, fun, wrapper) {
wrapper.a = arity;
wrapper.f = fun;
return wrapper;
}
function F2(fun) {
@ni-ko-o-kin
ni-ko-o-kin / main.js
Last active Sep 18, 2019
use elm with meteor without a meteor package
View main.js
// startup/client/main.js
import { Meteor } from 'meteor/meteor';
import '/elm-client/elm-main';
Meteor.startup(() => {
const app = Elm.Main.init({
node: document.getElementById('elm-root'),
flags: {},
});
@ni-ko-o-kin
ni-ko-o-kin / package.js
Last active Sep 18, 2019
elm compiler for meteor
View package.js
Package.describe({
summary: 'compile elm to js',
version: '1.0.0',
name: 'niko:elm',
});
Package.registerBuildPlugin({
name: 'elm',
sources: ['plugin.js'],
use: ['caching-compiler@1.2.0'],
View funWithParsers.elm
module Main exposing (main)
import Browser
import Debug exposing (log)
import Html exposing (Html, button, div, text)
import Html.Events exposing (onClick)
import Parser exposing (..)
import Tuple exposing (pair)