Skip to content

Instantly share code, notes, and snippets.

@stevekrouse
stevekrouse / main.html
Last active November 23, 2018 14:48
BlinkNote New Tab Chrome Extension - fastest way to take a note that'll stick around
<html>
<head>
</head>
<body>
<h1 id="error" style="display:none; color: red">Too many characters to save. Please delete some.</h1>
<div id="c" contenteditable style="min-height:300px;outline:none;"></div>
</body>
<script src="main.js"></script>
</html>
module Main exposing (main)
import Html exposing (Html, button, div, text)
import Html.Events exposing (onClick)
type alias Model =
{ count : Int }
-- model
count = 0
--reducer
update msg count =
case msg of
Increment ->
count + 1
-- view
clickEvents <- intButton clicksCount
clicksCount <- foldDyn (\accumulator currentValue -> accumulator + 1) 0 clickEvents
count = 0

update msg count =
  case msg of
    Increment ->
      count + 1
_nonWordRe = /[^a-zA-Z0-9\u00C0-\u00FF, ]+/g;
_iterateGrams = function(value, gramSize) {
gramSize = gramSize || 2;
var simplified = '-' + value.toLowerCase().replace(_nonWordRe, '') + '-',
lenDiff = gramSize - simplified.length,
results = [];
if (lenDiff > 0) {
for (var i = 0; i < lenDiff; ++i) {
value += '-';
}
group = xs => xs.reduce((rv, x) => {
(rv[x] = (rv[x] || [])).push(x);
return rv;
},
{});
objMap = (oldObj, func) => Object.keys(oldObj).reduce(function(newObj, current) {
newObj[current] = func(oldObj[current])
return newObj;
},
{});