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
array = [1, 2, 1, 2, 3, 2, 1, 2, 4, 5] | |
hash = Hash.new(array.uniq.size) | |
i = 0 | |
while(i < array.length) | |
if(!hash.has_key?(array[i])) | |
k = 0 | |
j = 0 |
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 vi(p) | |
p (self - p) | |
end | |
def do(p) | |
p (self + p) | |
end | |
def mn(p) | |
p (self * p) | |
end | |
def di(p) |
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 "Uvedit' vashe chyslo:" | |
number = gets.chomp.to_i | |
if(number < 23) | |
puts "Menshe" | |
elsif(number == 23) | |
puts "23" | |
elsif(number > 23) | |
puts "Bil'she" | |
else |
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
# coding: utf-8 | |
puts 'Здоровенькі були, я бідний албанський вірус.' | |
`eject -r` | |
puts 'Я поки що нічого не вмію і, на жаль, не можу завдати шкоди вашому комп’ютеру.' | |
`sudo beep -f 300 && sudo beep -f 500` | |
puts 'Будьте ласкаві, зітріть один важливий файл на жорсткому диску вашого комп’ютера самостійно і перешліть мене 30 друзям.' | |
`sudo beep -f 400 && sudo beep -f 600` | |
puts 'І буде вам щастя.' | |
`sudo beep -f 500 && sudo beep -f 700` | |
puts 'Якщо ви цього не зробите, я ображусь і не буде вам щастя і цукерок увесь наступний рік!' |
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 "Please, enter path: " | |
full = gets.chomp | |
filenames = Dir.entries(full) | |
filenames.delete(".") | |
filenames.delete("..") | |
puts "You have #{filenames.size} in your #{full} directory " | |
puts "They are #{filenames.join(' ')}" | |
puts "Do you really want to delete them? Yes/No" | |
choise = gets.chomp | |
if(choise[/^Y/]) |
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
#!/usr/bin/python3.2 | |
# *-* coding: utf-8 *-* | |
# Ranger by seniorihor | |
# 02.03.2012 (c) | |
print('''Welcome on board, Captain!!! | |
Select a number of action: | |
START - "1" (if undefined - range from zero) | |
FINISH - "2" (necessarily!) |
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
#!/usr/bin/python3.2 -tt | |
# *-* coding: utf-8 *-* | |
allow_names = ['Mila', 'Ihor', 'Stas', 'Michel', 'Bogdan'] | |
name = str(input('Enter your name: ')) | |
def birthday(name): | |
i = 0 | |
while i < len(allow_names): | |
# Check name |
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
#!/usr/bin/env ruby | |
# -*- coding: utf-8 -*- | |
# Aurhor: seniorihor (12.03.2012) | |
class General | |
def initialize(quantity, numbers) | |
@quantity = quantity | |
@numbers = numbers | |
@seconds = 0 | |
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
#!/usr/bin/env ruby | |
# -*- coding: utf-8 -*- | |
# Author: seniorihor (12.03.2012) | |
class MyArray | |
def initialize | |
@array = [] | |
end | |
def show_condition | |
print <<-CONDITION |
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
#!/usr/bin/env ruby | |
# -*- coding: utf-8 -*- | |
# Author: seniorihor (12.03.2012) | |
class MyArray | |
def initialize | |
@array = [] | |
@max_positive = 0 | |
@max_minimum = 0 | |
end |
OlderNewer