Skip to content

Instantly share code, notes, and snippets.

View neetsdkasu's full-sized avatar
🔰
take it easy

Leonardone @ NEETSDKASU neetsdkasu

🔰
take it easy
View GitHub Profile
@neetsdkasu
neetsdkasu / gen_unlambda.rb
Last active February 14, 2016 15:57
Unlambda Code Generator (半角文字の固定テキスト表示のみ) - ruby
# Unlambda Code Generator (半角文字の固定テキスト表示のみ)
# Autohr: Leonardone @ NEETSDKASU
# License: MIT License
# Target: unlambda-2.0.0
def test_genUL()
f = 'TextFile.txt'
ARGV << f if ARGV.empty? && ARGF.eof? && FileTest.exist?(f)
puts genUL(ARGF.read, 0, 60) if !ARGF.eof?
end
@neetsdkasu
neetsdkasu / gen_intercal.rb
Last active February 14, 2016 15:49
INTERCAL CODE GENERATOR (固定テキスト表示のみ) - ruby
# INTERCAL CODE GENERATOR (固定テキスト表示のみ)
# Author: Leonardone @ NEETSDKASU
# License: MIT License
# Target: Intercal c-intercal 28.0-r1
def test_genIC()
f = 'TextFile.txt'
ARGV << f if ARGV.empty? && ARGF.eof? && FileTest.exist?(f)
puts genIC(ARGF.read, false) if !ARGF.eof?
end
@neetsdkasu
neetsdkasu / splitOn.hs
Last active April 1, 2016 15:45
split sting (haskell)
-- Data.List.Split.splitOn や Data.Text.splitOn の代替(?)
import Data.List(isPrefixOf)
s = "bc k abcd Efg abc b c xyz bcbc xyz bc"
d = "bc"
x = splitOn d s -- x = [""," k a","d Efg a"," b c xyz ",""," xyz ",""]
splitOn :: Eq a => [a] -> [a] -> [[a]]
splitOn [] str = error "splitOn: empty input" -- Data.Textのはエラーだが、Rubyみたいに文字単位分割したいなら [[c] | c <- str]
@neetsdkasu
neetsdkasu / split.hs
Last active April 1, 2016 17:05
split string (haskell)
-- Data.Text.split の代替(?)
s = ",1,2,345,6,,7,8,"
x = split (== ',') s -- x = ["","1","2","345","6","","7","8",""]
split :: (a -> Bool) -> [a] -> [[a]]
split f str = loop str where
loop [] = [[]]
loop t = case s of
[] -> [w]
@neetsdkasu
neetsdkasu / genBF.rb
Last active February 14, 2016 15:57
Brainf*ck Code Generator (固定文字列表示のみ) - ruby
# Brainf*ck Code Generator (固定文字列表示のみ)
# Author: Leonardone @ NEETSDKASU
# License: MIT License
def test_genBF()
f = 'TextFile.txt'
ARGV << f if ARGV.empty? && ARGF.eof? && FileTest.exist?(f)
puts genBF(ARGF.read, 60, 10) if !ARGF.eof?
end