This file contains 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 'package:flutter/material.dart'; | |
void main() { | |
runApp(const Main()); | |
} | |
class Main extends StatelessWidget { | |
const Main({super.key}); | |
@override |
This file contains 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
name: Journal | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
schedule: | |
- cron: '0 0 * * *' | |
jobs: |
This file contains 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
puts"enter string to get reverse words" | |
line=gets | |
def reverse string | |
arr = string.split /\b/ | |
new_arr = arr.collect {|a| a.reverse} | |
new_arr.join | |
end | |
reverse=reverse(line) |
This file contains 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
//this is part flutter project (stick this into main file to see the magic ^-^) | |
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(Home()); | |
} | |
class Home extends StatefulWidget { | |
Home({Key? key}) : super(key: key); |
This file contains 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
output = (0..).reduce([]) do |accumulator, number| | |
binary = number.to_s(2) | |
reverse_binary = binary.reverse.sub!(/^0*/, "") | |
accumulator << number if binary == reverse_binary && number.to_s == number.to_s.reverse | |
break accumulator if accumulator.count >= 10 | |
accumulator | |
end | |
puts output |
This file contains 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
x =[[1, 2, 3] ,[4, 5, 7]] | |
y = [[1,2 ],[4, 5 ],[6 ,8]] | |
def multiply(x, y) | |
result = Array.new( x.length ) { Array.new( y[0].length ) {0} } | |
puts " here array is contsructed #{result} " | |
# "row is count of all the regular elements of array x [i.e. x.length]" | |
# "column is count of all the 1st elements of nested arrays of array y [i.e. y[0].length]" |
This file contains 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
friendgame_hash = {} | |
input = "" | |
friend = "" | |
game = "" | |
puts "Enter name of friend, then their favorite game: or Press Enter to quit" | |
input = gets.chomp | |
while input != "" do |
This file contains 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
def tower(count,from,to,via) | |
if count == 1 | |
to.unshift(from.shift) | |
puts"\n Move disk 1 from A to C\n" | |
else | |
tower(count - 1, from, via, to) | |
to.unshift(from.shift) | |
puts"\n Move disk #{count} from C to A\n" |
This file contains 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 = ARGV.first.split("") | |
input_array = input.map(&:to_i) | |
output = input_array.reduce({}) do |accumulator, element| | |
if accumulator[element] | |
accumulator[element] += 1 | |
else | |
accumulator[element] = 1 | |
end | |
accumulator | |
end |
This file contains 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
puts"______________________________\n" | |
puts" BETTING GAME\n" | |
puts"______________________________\n" | |
puts" ***** ***** *****\n" | |
puts" * * * * * *\n" | |
puts" * j * * Q * * K *\n" | |
puts" * * * * * *\n" | |
puts" ***** ***** *****\n" | |
puts"______________________________\n" | |
puts"rules : \n" |
NewerOlder