Last active
August 29, 2015 14:11
-
-
Save mcoms/2d5cea626ec50a6e48e0 to your computer and use it in GitHub Desktop.
Revisions
-
mcoms revised this gist
Dec 22, 2014 . 2 changed files with 3 additions and 3 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ def bitstream_to_text(bitstream) bitstream.join.gsub('111', '-').gsub('1', '.').gsub('0',' ') end 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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +0,0 @@ -
mcoms revised this gist
Dec 22, 2014 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ def bitstream_to_html(bitstream) bitstream.join.gsub('111', '-').gsub('1', '.').gsub('0',' ').html_safe end -
mcoms revised this gist
Dec 22, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -46,5 +46,5 @@ def calculate_bitstream(message) bits += [0, 0, 0] end bits.pop 3 bits end -
mcoms revised this gist
Dec 22, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -36,7 +36,7 @@ "8"=>[1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1], "9"=>[1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1], "0"=>[1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1], "/"=>[1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1] }) def calculate_bitstream(message) -
mcoms revised this gist
Dec 22, 2014 . 1 changed file with 40 additions and 40 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,43 +1,43 @@ MORSE_ALPHABET = Hash.new([]).merge!({ " "=>[0], "A"=>[1, 0, 1, 1, 1], "B"=>[1, 1, 1, 0, 1, 0, 1, 0, 1], "C"=>[1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1], "D"=>[1, 1, 1, 0, 1, 0, 1], "E"=>[1], "F"=>[1, 0, 1, 0, 1, 1, 1, 0, 1], "G"=>[1, 1, 1, 0, 1, 1, 1, 0, 1], "H"=>[1, 0, 1, 0, 1, 0, 1], "I"=>[1, 0, 1], "J"=>[1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1], "K"=>[1, 1, 1, 0, 1, 0, 1, 1, 1], "L"=>[1, 0, 1, 1, 1, 0, 1, 0, 1], "M"=>[1, 1, 1, 0, 1, 1, 1], "N"=>[1, 1, 1, 0, 1], "O"=>[1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1], "P"=>[1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1], "Q"=>[1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1], "R"=>[1, 0, 1, 1, 1, 0, 1], "S"=>[1, 0, 1, 0, 1], "T"=>[1, 1, 1], "U"=>[1, 0, 1, 0, 1, 1, 1], "V"=>[1, 0, 1, 0, 1, 0, 1, 1, 1], "W"=>[1, 0, 1, 1, 1, 0, 1, 1, 1], "X"=>[1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1], "Y"=>[1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1], "Z"=>[1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1], "1"=>[1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1], "2"=>[1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1], "3"=>[1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1], "4"=>[1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1], "5"=>[1, 0, 1, 0, 1, 0, 1, 0, 1], "6"=>[1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1], "7"=>[1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1], "8"=>[1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1], "9"=>[1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1], "0"=>[1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1], "/"=>[1,1,1,0,1,0,1,0,1,1,1,0,1] }) def calculate_bitstream(message) bits = [] -
mcoms revised this gist
Dec 22, 2014 . 1 changed file with 11 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -37,4 +37,14 @@ "9"=>[1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1], "0"=>[1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1], "/"=>[1,1,1,0,1,0,1,0,1,1,1,0,1] }) def calculate_bitstream(message) bits = [] message.upcase.each_char do |letter| bits += MORSE_ALPHABET[letter] bits += [0, 0, 0] end bits.pop 3 self.bitstream = bits end -
mcoms created this gist
Dec 22, 2014 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,40 @@ MORSE_ALPHABET = Hash.new([]).merge!({ " "=>[0], "A"=>[1, 0, 1, 1, 1], "B"=>[1, 1, 1, 0, 1, 0, 1, 0, 1], "C"=>[1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1], "D"=>[1, 1, 1, 0, 1, 0, 1], "E"=>[1], "F"=>[1, 0, 1, 0, 1, 1, 1, 0, 1], "G"=>[1, 1, 1, 0, 1, 1, 1, 0, 1], "H"=>[1, 0, 1, 0, 1, 0, 1], "I"=>[1, 0, 1], "J"=>[1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1], "K"=>[1, 1, 1, 0, 1, 0, 1, 1, 1], "L"=>[1, 0, 1, 1, 1, 0, 1, 0, 1], "M"=>[1, 1, 1, 0, 1, 1, 1], "N"=>[1, 1, 1, 0, 1], "O"=>[1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1], "P"=>[1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1], "Q"=>[1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1], "R"=>[1, 0, 1, 1, 1, 0, 1], "S"=>[1, 0, 1, 0, 1], "T"=>[1, 1, 1], "U"=>[1, 0, 1, 0, 1, 1, 1], "V"=>[1, 0, 1, 0, 1, 0, 1, 1, 1], "W"=>[1, 0, 1, 1, 1, 0, 1, 1, 1], "X"=>[1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1], "Y"=>[1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1], "Z"=>[1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1], "1"=>[1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1], "2"=>[1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1], "3"=>[1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1], "4"=>[1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1], "5"=>[1, 0, 1, 0, 1, 0, 1, 0, 1], "6"=>[1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1], "7"=>[1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1], "8"=>[1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1], "9"=>[1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1], "0"=>[1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1], "/"=>[1,1,1,0,1,0,1,0,1,1,1,0,1] })