Hal representers for Elixir
Have JSON/Hal representers for your modules
Library idea
lib/hal/hal.ex
:
defmodule APIWeb.Hal.Assignment
function shuffle<T>(array: T[]): T[] { | |
var currentIndex = array.length, temporaryValue, randomIndex; | |
// While there remain elements to shuffle... | |
while (0 !== currentIndex) { | |
// Pick a remaining element... | |
randomIndex = Math.floor(Math.random() * currentIndex); | |
currentIndex -= 1; |
declare module "react-lorem-ipsum" { | |
import React from "react" | |
interface AvatarProps { | |
gender?: "all" | "male" | "female" | |
className?: string | |
width?: number | |
height?: number | |
alt?: string | |
} |
<?php | |
/** | |
* Password management made easy | |
* | |
* @author Move Your Digital, Inc. | |
* @package Mu-Passwords | |
* @version 1.0.0 | |
*/ | |
/* |
country_code,country_name,category,price,prefixes,resource,direction,resolutions | |
AE,United Arab Emirates,,$0.27 ,9715,CALL,outbound,answered | |
AE,United Arab Emirates,,$0.27 ,971,CALL,outbound,answered | |
BR,Brazil,,$0.29 ,"551153, 551154, 551157, 55116, 55117, 55118, 55119, 55126, 55127, 55128, 55129, 55136, 55137, 55138, 55139, 55146, 55147, 55148, 55149, 55156, 55157, 55158, 55159, 55166, 55167, 55168, 55169, 55176, 55177, 55178, 55179, 55186, 55187, 55188, 55189, 5519, 55196, 55197, 55198, 55199, 55216, 55217, 55218, 55219, 55226, 55227, 55228, 55229, 55246, 55247, 55248, 55249, 55276, 55277, 55278, 55279, 55286, 55287, 55288, 55289, 55316, 55317, 55318, 55319, 55326, 55327, 55328, 55329, 5533, 55336, 55337, 55338, 55339, 55346, 55347, 55348, 55349, 55356, 55357, 55358, 55359, 55376, 55377, 55378, 55379, 55386, 55387, 55388, 55389, 55416, 55417, 55418, 55419, 55426, 55427, 55428, 55429, 55436, 55437, 55438, 55439, 55446, 55447, 55448, 55449, 55456, 55457, 55458, 55459, 55466, 55467, 55468, 55469, 55476, 55477, |
resource | category | country_code | direction | prefixes | resolutions | type | price | |
---|---|---|---|---|---|---|---|---|
CALL | tollfree | US | inbound | answered,missed,voicemail | 0.012 | |||
CALL | local | US | inbound | answered,missed,voicemail | 0.012 | |||
CALL | US | inbound | answered,missed,voicemail | 0.012 | ||||
CALL | tollfree | AE | inbound | answered,missed,voicemail | 0.67 | |||
CALL | tollfree | AR | inbound | answered,missed,voicemail | 0.7 | |||
CALL | local | AR | inbound | answered,missed,voicemail | 0.04 | |||
CALL | local | AT | inbound | answered,missed,voicemail | 0.02 | |||
CALL | tollfree | AT | inbound | answered,missed,voicemail | 0.59 | |||
CALL | national | AT | inbound | answered,missed,voicemail | 0.04 |
#!/usr/bin/env sh | |
docker rm $(docker ps -a | awk '{print $1}') | |
docker rmi $(docker images | awk '{print $3}') |
#!/usr/bin/env node | |
const fs = require('fs') | |
const usage = () => { | |
console.log('Usage: unload <aws-arn> <sql-statement-filepath> <name-of-file-in-s3>') | |
} | |
if (process.argv.length < 5 || process.argv[2] == '-h') { | |
usage() |
(defn wrap-options | |
[app] | |
(fn [request] | |
(if (= (request :request-method) :options) | |
(into request {:status 204}) | |
(app request)))) | |
(defn add-header | |
[r name value] | |
(assoc-in r [:headers name] value)) |
Have JSON/Hal representers for your modules
lib/hal/hal.ex
:
defmodule APIWeb.Hal.Assignment
country_code | type | price | |
---|---|---|---|
AR | tollfree | $0.70 | |
AR | local | $0.04 | |
AT | local | $0.02 | |
AT | national | $0.04 | |
AU | tollfree | $0.12 | |
AU | local | $0.04 | |
BA | national | $0.20 | |
BB | local | $0.10 | |
BE | local | $0.02 |