This file contains 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
# NOT idiomatic code.. just threw this together | |
# the need to unfold the stream for codepoints feels icky | |
# Plus not mapping counts across all lines, doing Enum.at! YUCK! | |
temp = File.stream!("path/to/file") | |
tempx = Enum.map(temp, fn line -> Stream.unfold(line, &String.next_codepoint/1) end) | |
tempy = Enum.map(tempx, fn line -> Enum.filter(line, fn x -> x == "," end) end) | |
Enum.count(Enum.at(tempy, 0)) |
This file contains 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
import Html exposing (Html, Attribute, div, h2, input, text) | |
import Html.Attributes exposing (class, type') | |
import Html.Events exposing (on, targetValue) | |
import Signal exposing (Address) | |
import String exposing (toLower, toInt) | |
import StartApp.Simple as StartApp | |
-- HELPERS |
This file contains 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
"use strict"; | |
const mongoose = require('mongoose'); | |
const thingWithNameSchema = mongoose.Schema({ | |
name: String, | |
}); | |
thingWithNameSchema.pre('validate', (next) => { | |
console.log(this); | |
console.log(this.name); | |
next(); |