Skip to content

Instantly share code, notes, and snippets.

View alco's full-sized avatar
🇺🇦

Oleksii Sholik alco

🇺🇦
View GitHub Profile
defmodule TimeFormat do
def format(seconds) do
hours = div(seconds, 3600)
remainder = rem(seconds, 3600)
minutes = div(remainder, 60)
seconds = rem(remainder, 60)
format(hours, minutes, seconds)
end
defp format(0, minutes, seconds), do: "#{minutes}:#{pad(seconds)}"

Keybase proof

I hereby claim:

  • I am alco on github.
  • I am alco (https://keybase.io/alco) on keybase.
  • I have a public key whose fingerprint is 4C14 8955 BB20 D94E 2483 4392 E5B2 32A7 2D91 58F1

To claim this, I am signing this object:

$ apib2swagger -i my_api.apib --yaml -o my_api.yaml
TypeError: Cannot read property 'length' of undefined
at jsonSchemaFromMSON (/usr/local/lib/node_modules/apib2swagger/index.js:266:38)
at /usr/local/lib/node_modules/apib2swagger/index.js:39:67
at Array.forEach (<anonymous>)
at /usr/local/lib/node_modules/apib2swagger/index.js:32:26
at Array.forEach (<anonymous>)
at module.exports.convertParsed (/usr/local/lib/node_modules/apib2swagger/index.js:29:8)
at Object.exports.convert (/usr/local/lib/node_modules/apib2swagger/index.js:402:23)
at processBlueprint (/usr/local/lib/node_modules/apib2swagger/bin/apib2swagger.js:87:18)

Keybase proof

I hereby claim:

  • I am alco on github.
  • I am alco (https://keybase.io/alco) on keybase.
  • I have a public key ASA-6JOvMKrK66jOsOUfwBvUgJBPGzmh-GhvgfbbwhONGgo

To claim this, I am signing this object:

defmodule Erlang do
@doc """
Receives a module definition (a string or a quoted expression), compiles it,
and returns a string with pretty printed Erlang code.
"""
def module_to_code(string) when is_binary(string) do
to_code_dispatch(Code.eval_string(string))
end
defmodule MapContainment do
def contains?(supermap, submap) do
# Convert the submap into a list of key-value pairs where each key
# is a list representing the keypath of its corresponding value.
flatten_with_list_keys(submap)
# Check that every keypath has the same value in both maps
# (assumes that `nil` is not a legitimate value)
|> Enum.all?(fn {keypath, val} when val != nil ->
get_in(supermap, keypath) == val
end)
defmodule HammingBench do
use Benchfella
use Bitwise
@n Stream.repeatedly(fn -> Enum.random [0, 1] end)
|> Enum.take(100_000)
|> Enum.join
|> String.to_integer(2)
bench "CharlesO" do
$ rm -rf _build/dev
$ mix release
WARN: Missing plugins: [rebar3_hex]
==> neotoma (compile)
==> erlware_commons (compile)
==> bbmustache (compile)
==> getopt (compile)
==> providers (compile)
==> relx (compile)
$ cd "/Users/alco/git/gun/logs/[email protected]_18.32.54/git.gun.ws_SUITE.logs/run.2015-10-26_18.32.58/log_private/"
$ wstest -m fuzzingserver -s /Users/alco/git/gun/test/ws_SUITE_data/server.json
Using explicit spec file '/Users/alco/git/gun/test/ws_SUITE_data/server.json'
Loading spec from /Users/alco/git/gun/test/ws_SUITE_data/server.json
Using Twisted reactor class <class 'twisted.internet.kqreactor.KQueueReactor'>
Using UTF8 Validator class <type 'wsaccel.utf8validator.Utf8Validator'>
Using XOR Masker classes <type 'wsaccel.xormask.XorMaskerNull'>
Testing git.gun.ws_SUITE: Starting test, 1 test cases
----------------------------------------------------
2015-10-26 17:37:17.687
Skipping the autobahn group because the Autobahn Test Suite is not installed.
To install it, please follow the instructions on this page:
http://autobahn.ws/testsuite/installation.html
Testing git.gun.ws_SUITE: *** SKIPPED {ws_SUITE,init_per_group} ***