Skip to content

Instantly share code, notes, and snippets.

Avatar
💜

Pedro Medeiros pedrosnk

💜
View GitHub Profile
View gist:10c714d1089cd0084960977f11516be4
Verifying that "pedrosnk.id" is my Blockstack ID. https://onename.com/pedrosnk
View problem1.erl
% First Code Kata from http://projecteuler.net/problem=1
% If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
% Find the sum of all the multiples of 3 or 5 below 1000.
-module(problem1).
-export([populate_list/1]).
-export([go/0]).
populate_list(1) -> [];
populate_list(Number) when (Number rem 3 == 0) or (Number rem 5 == 0) ->
@pedrosnk
pedrosnk / .vimrc
Last active Feb 4, 2016
My bash_profile color configuration on OSX
View .vimrc
set ts=2 sw=2 sts=2
"Expand column 80:w
"let &colorcolumn=80
let &colorcolumn=join(range(81,999),",")
"Hilight extra whitespace
highlight ExtraWhitespace ctermbg=red guibg=red
match ExtraWhitespace /\s\+$/
View guessing_game.ex
defmodule GuessingGameUI do
IO.puts "Elixir Guessing Game\n\n\n"
IO.puts "========================\n"
random_number = :random.uniform(10)
user_input = GuessingGame.convert_user_input(IO.gets('Enter your guess: '))
{status, message} = GuessingGame.check_user_input(user_input)
@pedrosnk
pedrosnk / balance.ex
Created May 2, 2014
Problems from scala course to elixir
View balance.ex
defmodule Balance do
def balance str do
balance(str, 0)
end
defp balance str, parenthesis_count do
if String.length(str) == 0 do
parenthesis_count == 0
else if parenthesis_count < 0 do
false
else