Skip to content

Instantly share code, notes, and snippets.

@adworse
Last active September 13, 2020 00:21
Show Gist options
  • Save adworse/271cce9316e9802f22b6d2c40f224a44 to your computer and use it in GitHub Desktop.
Save adworse/271cce9316e9802f22b6d2c40f224a44 to your computer and use it in GitHub Desktop.
defmodule Naive do
def trim_name do
name
|> String.codepoints
|> Enum.take(80)
|> to_string
end
end
iex> Repo.insert(%Company{name: name |> Naive.trim_name})
{:ok, %Company{name: "समुद्र के भीतर अचानक जब बड़ी तेज़ हलचल होने लगती है तो उसमें तूफान उठता है जिससे"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment