Skip to content

Instantly share code, notes, and snippets.

-module(submission).
-export([perimeter/1,area/1,enclose/1,bits/1,bits_tr/1]).
% Submission
% https://gist.github.com/klimisa/d6dd462aaf7b268b064b8dc18fa3dd58
% Shapes
perimeter({triangle,A,B,C}) ->
A+B+C;
perimeter({rectangle,W,L}) -> % W:Witdh,L:Length
@klimisa
klimisa / 2.6.erl
Last active February 28, 2017 13:02
% Direct recursion
product([])->
1;
product([X|Xs])->X*product(Xs).
% Tail recursion
product(Xs)->product(Xs,1).
product([],P)->
P;
-module(conlists).
-export([double/1,test_double/0
,evens/1,test_evens/0
,median/1,test_median/0
,modes/1,test_modes/0
,count/2,test_count/0
]).
% Double
double([]) ->
-module(index).
-export([get_file_contents/1,show_file_contents/1
,split/1
]).
% Used to read a file into a list of lines.
% Example files available in:
% gettysburg-address.txt (short)
% dickens-christmas.txt (long)
-module(index).
-export([get_file_contents/1,show_file_contents/1,split/1]).
% --------------------------------------------------
% !!! IMPORTANT !!!
% --------------------------------------------------
% Haven't finished the "Indexing a file"
% JUST broke the lines into words and numbered them.
% --------------------------------------------------
@klimisa
klimisa / frequency.erl
Created April 7, 2017 11:52
Enhancing the frequency server
%% Based on code from
%% Erlang Programming
%% Francecso Cesarini and Simon Thompson
%% O'Reilly, 2008
%% http://oreilly.com/catalog/9780596518189/
%% http://www.erlangprogramming.org/
%% (c) Francesco Cesarini and Simon Thompson
-module(frequency).
-export([start/0,allocate/0,deallocate/1,stop/0]).
@klimisa
klimisa / AegisType.cs
Last active May 3, 2017 16:50
Value Object Example
using System;
using System.Collections.Generic;
namespace Eope.Model.Aegises
{
public class AegisType
{
private readonly List<AegisType> _aegisTypes = new List<AegisType>
{
new AegisType("Συνέδριο"),
public void Save(Hospital hospital)
{
int numberOfRecordsAffected = 0;
using (var connection = new SqlConnection(_applicationSettings.ConnectionString))
{
var command = connection.CreateCommand();
command.CommandText = _UpdateSQL;
command.Parameters.Add(new SqlParameter("@Id", hospital.Id));
@klimisa
klimisa / index.html
Created June 26, 2017 07:21
Discogs Discogs Listings // source http://jsbin.com/qidagir
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Discogs Listings">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Discogs</title>
<style type="text/css">
.listItem {
background-color: #ccc;
Func<UnverifiedAccountDetails, Task<VerifiedAccountDetails>
Task<VerifiedAccountDetails> VerifyAccount(UnverifiedAccountDetails details);
Func<UnverifiedAccountDetails, Task<VerifiedAccountDetails>>
public delegate Task<VerifiedAccountDetails> VerifyAccount(UnverifiedAccountDetails details);