Skip to content

Instantly share code, notes, and snippets.

💭
Wholesome Stack Developer

Alexei Sholik alco

💭
Wholesome Stack Developer
Block or report user

Report or block alco

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View time_format.ex
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)}"
View keybase.md

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:

View gist:183714a0e37fa3041d05ef67ec7f2ca0
$ 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)
View keybase.md

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:

View erlang.ex
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
View map_containment.exs
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)
View hamming_bench.exs
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
View gist:dede31be07efcba18544
$ rm -rf _build/dev
$ mix release
WARN: Missing plugins: [rebar3_hex]
==> neotoma (compile)
==> erlware_commons (compile)
==> bbmustache (compile)
==> getopt (compile)
==> providers (compile)
==> relx (compile)
View gist:dd896721dda568f24f09
$ cd "/Users/alco/git/gun/logs/ct_run.ct@Alexs-MacBook-Pro.2015-10-26_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'>
View gist:6c844a94b59ac1c56476
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} ***
You can’t perform that action at this time.