Skip to content

Instantly share code, notes, and snippets.

View memclutter's full-sized avatar
:atom:
devops materia

Memory Clutter memclutter

:atom:
devops materia
View GitHub Profile
@memclutter
memclutter / down.sql
Created April 23, 2023 21:38
EAV in postgres
DROP TABLE attributes_array_smallint;
DROP TABLE attributes_array_int;
DROP TABLE attributes_array_bigint;
DROP TABLE attributes_timestamp;
DROP TABLE attributes_inet;
DROP TABLE attributes_boolean;
DROP TABLE attributes_varchar_2;
DROP TABLE attributes_varchar_4;
DROP TABLE attributes_varchar_8;
DROP TABLE attributes_varchar_16;
@memclutter
memclutter / myfilter.erl
Created July 24, 2017 13:22
Implementation of the filter function
-module(myfilter).
-export([filter/2]).
% Implementation of the filter function
filter(P, [H|T]) ->
case P(H) of
true -> [H|filter(P, T)];
false -> filter(P, T)
end;
@memclutter
memclutter / qsort.erl
Created July 23, 2017 17:09
Implementation of quick sorting on erlang
-module(qsort).
-export([qsort/1]).
% Implementation of quick sorting on erlang
qsort([]) -> [];
qsort([Pivot|T]) ->
qsort([X || X <- T, X < Pivot]) ++ [Pivot] ++ qsort([X || X <- T, X >= Pivot]).
@memclutter
memclutter / .gitconfig
Last active June 1, 2017 19:20
My .gitconfig
[user]
email = [email protected]
name = Memory Clutter
[push]
default = simple
[alias]
a = add
aa = add .
b = branch
bd = branch -D
@memclutter
memclutter / .vimrc
Created June 17, 2015 09:32
My .vimrc
set tabstop=4
set shiftwidth=4
set expandtab
set number
@memclutter
memclutter / sieve_of_eratosthenes.cpp
Created June 17, 2015 09:29
Sieve of Eratosthenes example on c++
/**
* Sieve of Eratosthenes example.
*
* In mathematics, the sieve of Eratosthenes, one of a number of prime number
* sieves, is a simple, ancient algorithm for finding all prime numbers up to
* any given limit.
*
* @see https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes
*/
#include <iostream>
@memclutter
memclutter / SingletonTrait.php
Created May 3, 2015 06:57
PHP Singleton Trait
<?php
/**
* Singleton Trait.
*
* Example:
*
* class MyClass
* {
* use SingletonTrait;