Skip to content

Instantly share code, notes, and snippets.

View daddydanielt's full-sized avatar

DANIEL TSENG daddydanielt

  • Taichung, Taiwan
View GitHub Profile
@daddydanielt
daddydanielt / Ruby Code Snippets.md
Last active August 29, 2015 14:03
Ruby Code Snippets
#Create an array with 'size' rand numbers between 's_n' and 'e_n'
size=10
s_n=0
e_n=100
arr=Array.new(size){ rand(s_n..e_n) }
@daddydanielt
daddydanielt / beautiful_strings.rb
Last active August 29, 2015 14:04
CodeEval - challenge coding snippets
# BEAUTIFUL_STRINGS (Facebook Hacker Cup 2013 Hackathon)
File.open(ARGV[0]).each_line do |line|
next if line.chomp.empty?
single_word_character_statistic =[]
l=line.chomp
l.split.each_with_index do |v,i|
s_v=v.chars.sort { |x,y| x.downcase <=> y.downcase }