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 App exposing (..) | |
| import Html | |
| type alias Flags = | |
| { name : String } | |
| type alias 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
| defmodule XmlNode do | |
| require Record | |
| Record.defrecord :xmlAttribute, Record.extract(:xmlAttribute, from_lib: "xmerl/include/xmerl.hrl") | |
| Record.defrecord :xmlText, Record.extract(:xmlText, from_lib: "xmerl/include/xmerl.hrl") | |
| def from_string(xml_string, options \\ [quiet: true]) do | |
| {doc, []} = | |
| xml_string | |
| |> :binary.bin_to_list | |
| |> :xmerl_scan.string(options) |
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 RedisHelper | |
| # decode Redis value back to Ruby object | |
| def self.decode(json) | |
| self.new(ActiveSupport::JSON.decode(json)["#{self.name.downcase}"]) | |
| end | |
| # encode Ruby object for Redis | |
| def encoded | |
| self.updated_at = nil | |
| self.to_json |