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 foobar n=100 | |
(1..n).each do |i| | |
output = "#{'Hi' if i % 3 == 0}#{'By' if i % 5 == 0}" | |
output = i.to_s if output.empty? | |
puts output | |
end | |
end | |
def swapcase str | |
str.chars.map{ |c| c == c.downcase ? c.upcase : c.downcase }.join |
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 | |
require 'json' | |
require 'pry' | |
url = "rtmp://fms.105.net/live/rmc1" | |
BITS_IN_BYTE = 8 | |
BYTES_IN_KB = 1024 | |
def compute_data type: 'video', frames: 1000, url: |
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
123 |
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
require 'axlsx' | |
package = Axlsx::Package.new | |
package.workbook do |workbook| | |
workbook.add_worksheet name: 'merged_cells' do |sheet| | |
sheet.add_row %w(a b c d e f g) | |
sheet.add_row %w(b c d x y z z) | |
sheet.merge_cells "A1:A2" | |
sheet.merge_cells "B1:B2" |
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 import_from_csv | |
existing_with_another_tn = [] | |
correct_users = [] | |
staffing_item_not_found = [] | |
extra = [] | |
total_count = 0 | |
CSV.read('./func_import_delim.csv').each do |row| | |
tn = row[0] | |
name = row[1] | |
staffing_item_id = row[2] |