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 EvercamMedia.Validation.Archive do | |
import String, only: [equivalent?: 2] | |
def validate_params(params) do | |
with :ok <- validate(:title, params["title"]), | |
:ok <- validate(:from_date, params["from_date"]), | |
:ok <- validate(:to_date, params["to_date"]), | |
:ok <- validate(:requested_by, params["requested_by"]), | |
:ok <- validate_boolean(:embed_time, params["embed_time"]), | |
:ok <- validate_boolean(:public, params["public"]), |
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
function sanitizeErrors(errs) { | |
var msg = errs.message; | |
var result = {}; | |
for (var key in msg) { | |
result[key] = key.replace('_', ' ') + ' ' + msg[key][0]; | |
} | |
return result; | |
} |
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
def from_list(list) do | |
{_, matrix} = do_from_list(list, [], %{}) | |
matrix | |
end | |
defp do_from_list(list, indices, matrix) do | |
Enum.reduce(list, {0, matrix}, fn | |
sublist, {idx, matrix} when is_list(sublist) -> | |
{sublist_idx, map} = do_from_list(sublist, [idx | indices], matrix) | |
{idx + 1, map} |
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
{ | |
"cloud_recordings": [ | |
{ | |
"frequency": 60, | |
"storage_duration": 30, | |
"status": "on", | |
"schedule": { | |
"Monday": [ | |
"00:00-23:59" | |
], |
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
{"ID":68814,"KIND":10,"POSTDATE":"01\/02\/2012","NUMBER":"SI-000539","REFERENCE":null,"MANAGERNAME":"","CURRENCYID":3,"CURRENCYSYMBOL":"\u20AC","FRGAMTVATINC":263.3,"FRGDUEAMT":0,"NEXTCREATEDATE":null} |
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 EvercamMedia.PublicController do | |
use EvercamMedia.Web, :controller | |
alias EvercamMedia.PublicView | |
import Ecto.Query | |
require IEx | |
@default_distance 1000 | |
@default_offset 0 | |
@default_limit 100 |
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 EvercamMedia.PublicView do | |
use EvercamMedia.Web, :view | |
alias EvercamMedia.Util | |
def render("index.json", %{cameras: cameras, total_pages: total_pages, count: count}) do | |
%{ | |
cameras: Enum.map(cameras, fn(camera) -> | |
%{ | |
id: camera.id, | |
name: camera.name, |
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
rror] #PID<0.806.0> running EvercamMedia.Endpoint terminated | |
Server: localhost:4000 (http) | |
Request: GET /v1/public/cameras?within_distance=26571.402417023513&is_near_to=dublin&geojson=true | |
** (exit) an exception was raised: | |
** (FunctionClauseError) no function clause matching in Plug.Conn.resp/3 | |
(plug) lib/plug/conn.ex:455: Plug.Conn.resp(%Plug.Conn{adapter: {Plug.Adapters.Cowboy.Conn, :...}, assigns: %{geojson_cameras: [%Camera{__meta__: #Ecto.Schema.Metadata<:loaded, "cameras">, access_rights: #Ecto.Association.NotLoaded<association :access_rights is not loaded>, cloud_recordings: #Ecto.Association.NotLoaded<association :cloud_recordings is not loaded>, config: %{"auth" => %{"basic" => %{"password" => "aoife", "username" => "aoifemcd"}}, "external_host" => "www.nci.ie", "external_http_port" => 80, "external_rtsp_port" => "", "snapshots" => %{"jpg" => "/ispy/cam2/webcam2.jpg"}}, created_at: #Ecto.DateTime<2014-10-02 13:09:05.795039>, discoverable: true, exid: "gardiner2", id: 3262, is_online: tru |
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
users[index]["created_at"] ? DateTime.parse(users[index]["created_at"]).strftime("%A, %d %b %Y %l:%M %p") : "", | |
users[index]["confirmed_at"] ? DateTime.parse(users[index]["confirmed_at"]).strftime("%A, %d %b %Y %l:%M %p") : "", | |
users[index]["last_login_at"] ? DateTime.parse(users[index]["last_login_at"]).strftime("%A, %d %b %Y %l:%M %p") : "", |
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
#!/usr/bin/env sh | |
### Download and install megaraidcli for Ubuntu; | |
FILE="megacli_8.07.14.orig.tar.gz" | |
LINK="http://hwraid.le-vert.net/ubuntu/sources/$FILE" | |
wget $LINK -O /tmp/$FILE | |
( | |
cd /tmp |