Skip to content

Instantly share code, notes, and snippets.

View pedrosnk's full-sized avatar
💜

Pedro Medeiros pedrosnk

💜
View GitHub Profile
@pedrosnk
pedrosnk / balance.ex
Created May 2, 2014 15:02
Problems from scala course to elixir
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
@pedrosnk
pedrosnk / guessing_game.ex
Last active January 3, 2016 20:59
Guessing Game on Elixir based on blog post http://www.elixirdose.com/elixir-guessing-game/
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 / problem1.erl
Created June 25, 2012 12:02
Learning Erlang
% 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) ->
Verifying that "pedrosnk.id" is my Blockstack ID. https://onename.com/pedrosnk
@pedrosnk
pedrosnk / .vimrc
Last active March 12, 2024 14:33
My bash_profile color configuration on OSX
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\+$/