Skip to content

Instantly share code, notes, and snippets.

View imetallica's full-sized avatar

Iuri L. Machado imetallica

View GitHub Profile
type Fruit =
| Apple
| Orange
| Papaya
int x = 0;
x = 2;
-module(factorial).
-export[fac1/1, fac2/1].
%% With guards
fac1(x) when x <= 0 -> 1;
fac1(x) when x > 0 -> x * fac(x-1).
%% With pattern-matching [does not handle x < 0]
fac2(x) ->
case x of
00:10:41.238 [error] Error in process <0.692.0> with exit value: {[{reason,undef},{mfa,{'Elixir.Site.Index',init,3}},{stacktrace,[{'Elixir.Site.Index',init,[{tcp,http},{http_req,#Port<0.6711>,ranch_tcp,keepalive,<0.692.0>,<<3 bytes>>,'HTTP/1.1',{{127,0,0,1},47170},<<9 bytes>>,undefined,8080,<<1 byte>>,undefined,<<0 bytes>>,undefined,[],[{<<4 bytes>>,<<14 bytes>>},{<<10 bytes>>,<<76 bytes>>},{<<6 bytes>>,<<63 bytes>>},{<<15 bytes>>,<<14 bytes>>},{<<15 bytes>>,<<13 bytes>>},{<<10 bytes>>,<<10 bytes>>},{<<13 bytes>>,<<9 bytes>>}],...
00:10:41.272 [error] Ranch listener :my_http_listener had connection process started with :cowboy_protocol:start_link/4 at #PID<0.692.0> exit with reason: {[reason: :undef, mfa: {Site.Index, :init, 3}, stacktrace: [{Site.Index, :init, [{:tcp, :http}, {:http_req, #Port<0.6711>, :ranch_tcp, :keepalive, #PID<0.692.0>, "GET", :"HTTP/1.1", {{127, 0, 0, 1}, 47170}, "localhost", :undefined, 8080, "/", :undefined, "", :undefined, [], [{"host", "localhost:8080"}, {"user-agent", "Mozilla/
defmodule Alchemy.Time do
@author "Iuri L. Machado <[email protected]>"
@copyright "2015 .Fix."
@license "BSD"
use GenServer
require Logger
@moduledoc """
RFC 1123 Time compatible. It caches time on an ets table that is updated
from django.db import models
from django.contrib.auth.models import User
class Todo(models.Model):
"""
A Todo dummy class.
"""
created = models.DateTimeField(auto_now_add=True)
author = models.ForeignKey(User)
text = models.CharField(max_length=255)
#include <vector>
#include <iostream>
class Example {
public:
static int STATIC_VARIABLE;
static std::vector<Example> examples;
int NON_STATIC_VARIABLE;
Example(int mod) {
#ifndef __EXAMPLE_H__
#define __EXAMPLE_H__
#include <vector>
class Example {
public:
static int D;
static vector<Example> examples;
}