Normal Text
Related Setup: https://gist.github.com/hofmannsven/6814278
Related Pro Tips: https://ochronus.com/git-tips-from-the-trenches/
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
module Models.Language exposing (..) | |
import Json.Decode exposing (int, string, decodeString, Decoder) | |
import Json.Decode.Pipeline exposing (decode, required) | |
type alias Language = | |
{ id : Int | |
, name : String | |
, label : String |
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
{ | |
"location": { | |
"woeid": 2502265, | |
"city": "Sunnyvale", | |
"region": " CA", | |
"country": "United States", | |
"lat": 37.371609, | |
"long": -122.038254, | |
"timezone_id": "America/Los_Angeles" | |
}, |
[fl, sl, v] =
[1, 2, 3, 4, 5, 6, 7, 8, 9]
|> Enum.with_index()
|> Enum.reduce([], fn
{v, idx}, acc when idx < 4 -> [v | acc]
{v, idx}, acc when idx == 4 -> [[], acc | [v]]
{v, idx}, [hd | tl] when idx > 4 -> [[v | hd] | tl]
end)
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
DROP FUNCTION if exists aggregate_data(tbl_from text, tbl_to text); | |
CREATE OR REPLACE FUNCTION aggregate_data(tbl_from text, tbl_to text) RETURNS void AS $$ | |
DECLARE | |
parsed_time text = split_part(tbl_to, 'agg_', 2); | |
time_val text; | |
BEGIN | |
CASE parsed_time | |
WHEN '1m' THEN | |
time_val = '1 minute'; |
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
defmodule Map.Helpers do | |
@moduledoc """ | |
Functions to transform maps | |
""" | |
@doc """ | |
Convert map string camelCase keys to underscore_keys | |
""" | |
def underscore_keys(nil), do: nil |
OlderNewer