Skip to content

Instantly share code, notes, and snippets.

View alco's full-sized avatar
🇺🇦

Oleksii Sholik alco

🇺🇦
View GitHub Profile
@alco
alco / gist:5264613
Created March 28, 2013 16:26
Tried to clone a mercurial repo. Usability is below 0. What happened? What's my fault and what's not? Damn.
λ hg clone https://go.googlecode.com/hg/
warning: go.googlecode.com certificate with fingerprint e6:d8:e0:12:d8:83:4e:63:2f:eb:20:87:26:e9:50:aa:28:52:b1:d4 not verified (check hostfingerprints or web.cacerts config setting)
destination directory: hg
requesting all changes
adding changesets
adding manifests
adding file changes
transaction abort!
rollback completed
abort: connection ended unexpectedly
@alco
alco / non-tail-recursive.ex
Created March 29, 2013 18:29
See my comment below for explanation.
def sum([]) do
return 0
end
def sum([h|t]) do
h + sum(t)
end
package main
import (
m "math"
)
const LIMIT = 100
func main() {
// They don't recomend working with raw arrays, so use a slice
@alco
alco / gist:5328272
Last active December 15, 2015 21:49
λ git remote -v
origin git@github.com:alco/elixir.git (fetch)
origin git@github.com:alco/elixir.git (push)
source git://github.com/elixir-lang/elixir (fetch)
source git://github.com/elixir-lang/elixir (push)
λ git pull source
Already up-to-date.
@alco
alco / pretty.ex
Last active December 16, 2015 00:49
@doc """
Get a time zone object for the specified offset or name.
When offset or name is invalid, ArgumentError exception is raised.
## Examples
iex> timezone()
#=> <local time zone>
==> elixir (compile)
Compiled src/elixir_parser.yrl
Compiled src/elixir_transform.erl
Compiled src/elixir_tree_helpers.erl
Compiled src/elixir_try.erl
Compiled src/elixir_sup.erl
Compiled src/elixir_scope.erl
Compiled src/elixir_translator.erl
Compiled src/elixir_quote.erl
Compiled src/elixir_partials.erl
==> elixir (compile)
Compiled src/elixir_parser.yrl
Compiled src/elixir_transform.erl
Compiled src/elixir_tree_helpers.erl
Compiled src/elixir_try.erl
Compiled src/elixir_sup.erl
Compiled src/elixir_scope.erl
Compiled src/elixir_translator.erl
Compiled src/elixir_quote.erl
Compiled src/elixir_partials.erl
defrecord Obnoxious, nitems: 5 do
def iterate([h|t]) do
{ h, t }
end
def iterate([]) do
:stop
end
end
λ go run test.go
Apr 18 16:28:23 MacBook-Pro-de-Alex.local a.out[58463] <Error>: kCGErrorInvalidConnection: CGSGetCurrentCursorLocation: Invalid connection
Apr 18 16:28:23 MacBook-Pro-de-Alex.local a.out[58463] <Error>: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.
Apr 18 16:28:23 MacBook-Pro-de-Alex.local a.out[58463] <Error>: kCGErrorInvalidConnection: CGSGetCurrentCursorLocation: Invalid connection
Apr 18 16:28:23 MacBook-Pro-de-Alex.local a.out[58463] <Error>: kCGErrorInvalidConnection: CGSNewWindowWithOpaqueShape: Invalid connection
2013-04-18 16:28:23.573 a.out[58463:1e03] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error (1002) creating CGSWindow on line 263'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff9022cf56 __exceptionPreprocess + 198
1 libobjc.A.dylib 0x00007fff88481d5e objc_exception_throw + 43
Eshell V5.9.3.1 (abort with ^G)
1> catch 1/0.
{'EXIT',{badarith,[{erlang,'/',[1,0],[]},
{erl_eval,do_apply,6,[{file,"erl_eval.erl"},{line,576}]},
{erl_eval,expr,5,[{file,"erl_eval.erl"},{line,360}]},
{shell,exprs,7,[{file,"shell.erl"},{line,668}]},
{shell,eval_exprs,7,[{file,"shell.erl"},{line,623}]},
{shell,eval_loop,3,[{file,"shell.erl"},{line,608}]}]}}