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
defp validate_params(params) do | |
with :ok <- validate?("frequency", params["frequency"]), | |
:ok <- validate?("storage_duration", params["storage_duration"]), | |
:ok <- validate?("status", params["status"]), | |
do: :ok | |
end | |
def validate?("status", "on"), do: :ok | |
def validate?("status", "off"), do: :ok | |
def validate?("status", "on-scheduled"), do: :ok |
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
defp validate_params(params) do | |
cond do | |
!validate?(params["frequency"]) -> | |
{:invalid, "The parameter 'frequency' isn't valid."} | |
!validate?(params["storage_duration"]) -> | |
{:invalid, "The parameter 'storage_duration' isn't valid."} | |
!cr_status?(params["status"]) -> | |
{:invalid, "The parameter 'status' isn't valid."} | |
true -> | |
{:ok} |
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
Short but not appreciated enough | |
defp validate_params(params) do | |
cond do | |
!validate?(params["frequency"]) -> | |
{:invalid, "The parameter 'frequency' isn't valid."} | |
!validate?(params["storage_duration"]) -> | |
{:invalid, "The parameter 'storage_duration' isn't valid."} | |
!cr_status?(params["status"]) -> | |
{:invalid, "The parameter 'status' isn't valid."} |
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 Password do | |
@regex_for_mac ~r/^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/ | |
def generate(mac_address) do | |
case check_mac(mac_address) do | |
{:invalid, message} -> | |
message | |
{:ok} -> | |
password = |
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
fnShowHide = (iCol, oTable) -> | |
bVis = oTable.fnSettings().aoColumns[iCol].bVisible | |
oTable.fnSetColumnVis iCol, if bVis then false else true |
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
<!DOCTYPE html> | |
<html > | |
<head> | |
<meta charset="UTF-8"> | |
<title>WEATHER API</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<link rel="stylesheet" href="css/reset.css"> | |
<link rel="stylesheet prefetch' href='https://fonts.googleapis.com/css?family=Open+Sans"> |
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
files: | |
"/opt/elasticbeanstalk/hooks/appdeploy/post/01_cron.sh": | |
mode: "000755" | |
owner: root | |
group: root | |
content: | | |
#!/usr/bin/env bash | |
# Using similar syntax as the appdeploy pre hooks that is managed by AWS | |
set -xe |
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
$("#merge_datatables").on 'click', '.action-cam', -> | |
$('#loading-popup').show() | |
host = $(this).parents('tr').find('td:nth-child(1)').text() | |
port = $(this).parents('tr').find('td:nth-child(2)').text() | |
jpg = $(this).parents('tr').find('td:nth-child(3)').text() | |
d = {} | |
d.host = host | |
d.port = port | |
d.jpg = jpg | |
$.ajax |
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
A little glance on what world is using right now | |
[WordPress JS Coding Styles](https://make.wordpress.org/core/handbook/best-practices/coding-standards/javascript/) | |
[JQuery Officials](https://contribute.jquery.org/style-guide/js/) | |
[Google Coding Style](https://google.github.io/styleguide/javascriptguide.xml) | |
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
CREATE TABLE cameras | |
( | |
id integer NOT NULL DEFAULT nextval('sq_streams'::regclass), | |
created_at timestamp with time zone NOT NULL DEFAULT now(), | |
updated_at timestamp with time zone NOT NULL DEFAULT now(), | |
exid text NOT NULL, | |
owner_id integer NOT NULL, | |
is_public boolean NOT NULL, | |
config json NOT NULL, | |
name text NOT NULL, |