This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am opsb on github. | |
* I am opsb (https://keybase.io/opsb) on keybase. | |
* I have a public key ASBg7PHvykg451W-HQfK-YRqt-SEdI111bE8iELEjsndZQo | |
To claim this, I am signing this object: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module View.Grid exposing (view) | |
import Element exposing (Element, column, el, fill, row, spacing, width) | |
import List.Extra | |
type alias Config = | |
{ itemsPerRow : Int | |
, horizontalSpacing : Int | |
, verticalSpacing : Int |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Util.Tree do | |
def transform_keys(map, transform) when is_map(map) do | |
Map.new( | |
Enum.map(map, fn {k, v} -> | |
{transform.(k) |> IO.inspect(label: "transformed"), transform_keys(v, transform)} | |
end) | |
) | |
end | |
def transform_keys(list, transform) when is_list(list) do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Cursor exposing (cursor, Cursor(..)) | |
import Element exposing (Element, Attribute, htmlAttribute) | |
import Html.Attributes | |
cursor : Cursor -> Attribute msg | |
cursor cursor_ = | |
htmlAttribute <| Html.Attributes.style "cursor" (cursorName cursor_) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Util.Ecto do | |
def export(model = %{__meta__: _meta, __struct__: _struct}) when is_map(model) do | |
stripped = | |
model | |
|> Map.from_struct() | |
|> Map.delete(:__meta__) | |
associations = model.__struct__.__schema__(:associations) | |
Enum.reduce(associations, stripped, fn assoc, model -> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
view model = | |
HolyGrail.view | |
|> HolyGrail.header | |
(HeaderCard.config | |
|> HeaderCard.leftGutter Avatar.small | |
|> HeaderCard.title "Using AI to Detect Emotions in text" | |
) | |
|> HolyGrail.body | |
(ScrollPaneCard.view | |
[ ChatDay.config |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AppState (Main.elm delegates to one of these) | |
LoggedIn | |
Context.elm | |
Init.elm | |
Model.elm | |
Msg.elm | |
Subscriptions.elm | |
Update.elm | |
UrlUpdate.elm | |
View.elm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Helpers.Actions do | |
def set_text(parent, %Query{} = query, text) when is_binary(text) do | |
parent |> find(query) | |
case Query.compile(query) do | |
{:css, selector} -> | |
parent | |
|> pipeline_script("document.querySelector('#{selector}').value = '#{text}'") | |
|> pipeline_script("document.querySelector('#{selector}').dispatchEvent(new Event('input'))") | |
{:xpath, xpath} -> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.js"></script> | |
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery.ns-autogrow/1.1.6/jquery.ns-autogrow.min.js"></script> | |
<script> | |
$(document).ready(function() { | |
$('.new-message textarea').autogrow({vertical: true, horizontal: false}); | |
}); | |
</script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
onEnter : Msg -> Attribute Msg | |
onEnter msg = | |
let | |
filterKey ( code, shift ) = | |
if (isEnter code) && (not shift) then | |
Ok "triggering" | |
else | |
Err "not triggering" | |
decoder = |