Skip to content

Instantly share code, notes, and snippets.

View alco's full-sized avatar
🇺🇦

Oleksii Sholik alco

🇺🇦
View GitHub Profile
iex> """ |> Erlang.module_to_core |> IO.puts
...> -file("nofile", 1).
...> -module('Elixir.M').
...>
...> -export([hello/0]).
...>
...> hello() -> hello.
...> """
module 'Elixir.M' ['hello'/0,
'module_info'/0,
@coffeemug
coffeemug / gist:6168031
Last active October 15, 2024 01:08
The fun of implementing date support
After spending the better part of the month implementing date support
in RethinkDB, Mike Lucy sent the team the following e-mail. It would
have been funny, if it didn't cause thousands of programmers so much
pain. Read it, laugh, and weep!
-----
So, it turns out that we're only going to support dates between the
year 1400 and the year 10000 (inclusive), because that's what boost
supports.
@Nicd
Nicd / gist:6158820
Created August 5, 2013 19:35
Around 800 MB to compile with 'mix compile' in an otherwise empty project, on OS X 10.6.8 with elixir 0.10.1-dev.
defmodule ExCoder do
def encode(str) do
end
def decode("	"), do: " "
def decode("
"), do: """
@sferik
sferik / future.ex
Last active October 23, 2018 18:46 — forked from josephwilk/future.ex
defmodule Future do
def new(fun) do
fn(x) ->
spawn_link fn ->
value = try do
{ :ok, fun.(x) }
rescue
e -> { :error, e }
end
@nox
nox / atkin.erl
Last active December 20, 2015 04:49
Sieve of Atkin in Erlang with a mutable HiPE bitarray. Forgive me, I was bored.
-module(atkin).
-export([primes_smaller_than/1]).
primes_smaller_than(Limit) ->
primes_smaller_than(Limit, sieve(Limit), []).
primes_smaller_than(0, _, Acc) ->
Acc;
primes_smaller_than(N, Bin, Acc) ->
# coding=utf-8
"""
LICENSE http://www.apache.org/licenses/LICENSE-2.0
"""
import datetime
import sys
import time
import threading
import traceback
import SocketServer
fn main() {
let x = 2;
let y = "nope";
match y {
_ if x == 2 => println("is two"),
_ => println("not two")
}
}
@quchen
quchen / trolling_haskell
Last active November 12, 2024 00:10
Trolling #haskell
13:15 <xQuasar> | HASKELL IS FOR FUCKIN FAGGOTS. YOU'RE ALL A BUNCH OF
| FUCKIN PUSSIES
13:15 <xQuasar> | JAVASCRIPT FOR LIFE FAGS
13:16 <luite> | hello
13:16 <ChongLi> | somebody has a mental illness!
13:16 <merijn> | Wow...I suddenly see the error of my ways and feel
| compelled to write Node.js!
13:16 <genisage> | hi
13:16 <luite> | you might be pleased to learn that you can compile
| haskell to javascript now
@dherman
dherman / cat.js
Last active December 25, 2015 16:01
comparing different iteration protocols
// EXAMPLE: a compound iterator with sequencing
// Python style
function cat() {
let is = arguments;
return {
next: {
let length;
while ((length = is.length) > 0) {
try {