This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Graphics.Element exposing (show) | |
main = show (iterate 100) | |
fizzbuzz : Int -> String | |
fizzbuzz n = | |
if | mod n 15 -> "FizzBuzz" | |
| mod n 5 -> "Buzz" | |
| mod n 3 -> "Fizz" | |
| otherwise -> toString n |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for i<-1..100,r=&(rem(&1, &2)==0 && &3),x=(r.(i,15,"FizzBuzz")||r.(i,5,"Buzz")||r.(i,3,"Fizz")||i),do: IO.write "#{x} " |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule AssertMore do | |
@moduledoc """ | |
More assert functions. | |
""" | |
import ExUnit.Assertions, only: [assert: 1, assert: 2] | |
@doc """ | |
Asserts that two data structures are equal, except certain keys. | |
The data structures can be nested, such as maps with lists with maps. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# These are most of the Ecto touchpoints within Phoenix. | |
# I may have missed a few though. | |
# / | |
## mix.exs | |
:postgrex, :phoenix_ecto | |
# web/ | |
## web.ex | |
* controller & channel |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
list = for i <- 1..4, do: <<255>> | |
my_int = :crypto.bytes_to_integer(:erlang.list_to_binary list) | |
iex> Enum.reduce(1..255, [], fn(x, acc) -> [x|acc] end) |> IO.iodata_to_binary |> byte_size | |
255 | |
iex(7)> :crypto.bytes_to_integer(:erlang.list_to_binary list) | |
16777215 | |
iex(96)> <<a::1, rest::bitstring>> = :erlang.integer_to_binary 0b00000001 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Phtest.OrientConnector do | |
use Jazz | |
@base_url "http://localhost:2480/" | |
@database "Phtest" | |
@user "admin" | |
@password "admin" | |
@basic_auth [basic_auth: {@user, @password}] | |
def get(document_id, type) do | |
OrientConnector.get_document(document_id) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if System.get_env("EXERCISM_TEST_EXAMPLES") do | |
Code.load_file("example.exs") | |
else | |
Code.load_file("point_mutations.exs") | |
end | |
ExUnit.start | |
defmodule DNATest do | |
use ExUnit.Case, async: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
input { | |
tcp{ | |
port => 5000 | |
} | |
} | |
filter { | |
# Only process messages that have the keywords Audit or System. | |
if ([message] =~ "Audit|System" ) { | |
json { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import subprocess | |
import sys | |
import string | |
import re | |
for dir, subdir, files in os.walk( sys.argv[1] ): | |
for filename in files: | |
# ignore OSX fs file | |
if( filename != ".DS_Store"): |
NewerOlder