Web Application Testing In Ruby
It's a library for the Ruby language which simulates users actions on major web browsers.
| const queryStringToJSON = query => ( | |
| query.slice(1).split('&').map(d => d.split('=')).reduce( | |
| (acc, [head, tail]) => ({ ...acc, [head]: tail }), 0) | |
| ) |
| rotate :: (Double, Double) -> Double -> (Double, Double) | |
| rotate (x, y) a = (x', y') | |
| where | |
| co = cos a | |
| si = sin a | |
| x' = x * co - y * si | |
| y' = x * si + y * co |
| {-# LANGUAGE OverloadedStrings #-} | |
| module Lib | |
| ( someFunc | |
| ) where | |
| import Network.HTTP.Client | |
| import Network.HTTP.Client.TLS | |
| import qualified Data.ByteString.Char8 as B8 (pack) | |
| import qualified Data.ByteString.Lazy.Char8 as L8 |
| const throttle = (time, f) => (...args) => { | |
| const now = Date.now() | |
| return () => { | |
| if ((now + time - Date.now()) < 0) { | |
| f(...args) | |
| now = Date.now() | |
| } | |
| } | |
| } |
| const debounce = (time, f) => (...args) => ( | |
| Promise.race([ | |
| new Promise((_, reject) => setTimeout(reject, time, 'TIMEOUT')), | |
| f(...args) | |
| ]) | |
| ) | |
| export default debounce |
| const prepareQueries = queryParams => | |
| `?${Object.entries(queryParams) | |
| .map(kv => kv.join('=')) | |
| .join('&')}`; | |
| export default prepareQueries; |
| # Bubble sort | |
| defmodule Bubble do | |
| def sort([]), do: [] | |
| def sort(l) do | |
| round = swap_itr(l) | |
| cond do | |
| round == l -> l | |
| true -> sort(round) | |
| end | |
| end |
| defmodule Utils do | |
| def value_at(list, 0), do: List.first(list) | |
| def value_at(list, index) when index > length(list), do: raise "Index(#{index}) out of bounds on List" | |
| def value_at(list, index) when index > 0 do | |
| [_ | tail] = list | |
| value_at(tail, index - 1) | |
| end | |
| end |