Skip to content

Instantly share code, notes, and snippets.

View Piyush-Chaudhary's full-sized avatar
🎯
Focusing

Piyush Chaudhary Piyush-Chaudhary

🎯
Focusing
View GitHub Profile
Write a function that parses following input and prints date in your local timezone:
input = "{\"time\":\"2022-06-17T05:52:39.787Z\"}"
parser(input) => "2022-06-17 07:54:13 +0200"
def local_time(t)
t.local
end
def rev_str(a)
rev = ''
for i in 1..a.length
puts a[i]
rev += a[a.length - i]
end
puts rev
end
def fib(n)
if (n<=2)
return 1
else
return (fib(n-1)+fib(n-2))
end
end