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
const TOAST_DURATION = 3500; | |
const BsToastHook = { | |
mounted() { | |
this.handleEvent('show_toast', ({ id }) => { | |
const toastElem = document.getElementById(id); | |
if (toastElem) { | |
const toast = new bootstrap.Toast(toastElem, {delay: TOAST_DURATION}); | |
toast.show(); |
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
const TOAST_DURATION = 3500; | |
const BsToastHook = { | |
mounted() { | |
this.handleEvent('show_toast', ({ id }) => { | |
const toastElem = document.getElementById(id); | |
if (toastElem) { | |
const toast = new bootstrap.Toast(toastElem, {delay: TOAST_DURATION}); | |
toast.show(); |
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
# Using https://github.com/tungd/elixir-dns | |
@servers_dns "all.api.radio-browser.info" | |
# DNS lookup | |
def get_servers() do | |
DNS.query(@servers_dns) | |
|> Map.get(:anlist) | |
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
<?php | |
const SERVERS_DNS = 'all.api.radio-browser.info'; | |
function getServers(): array | |
{ | |
$serversFromDns = dns_get_record(SERVERS_DNS, DNS_ANY); | |
$serversAll = array_reduce($serversFromDns, function ($result, $record) { | |
$ip = isset($record['ip']) ? $record['ip'] : $record['ipv6']; | |
$host = gethostbyaddr($ip); |
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 Aseigo do | |
def split_even_odd_index(list) do | |
split_even_odd_index(list, true, {[], []}) | |
end | |
defp split_even_odd_index([], _even_odd, result), do: result | |
defp split_even_odd_index([head | tail], true, {evens, odds}) do | |
split_even_odd_index(tail, false, {[head | evens], odds}) | |
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
/** | |
* Filter a collection by a property and an array of values | |
* demo: http://jsfiddle.net/3Y95F/ | |
* | |
* @param {array|object} collection (of objects) | |
* @param {string} property | |
* @param {array} array of accepted values | |
* @returns {array|object} | |
*/ | |
_.mixin({ |