This file contains hidden or 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
class Image | |
attr_accessor :image | |
def initialize(image) | |
@image = image | |
end | |
def print_row(row) | |
row.each {|x| print x } |
This file contains hidden or 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
class Image | |
def initialize(image) | |
@image = image | |
end | |
#output_image to output the image | |
def output_image | |
@image.each do |line| | |
line.each do |cell| |
This file contains hidden or 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
class LinkedListNode | |
attr_accessor :value, :next_node | |
def initialize(value, next_node=nil) | |
@value = value | |
@next_node = next_node | |
end | |
end |
This file contains hidden or 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
class Image | |
def initialize(image) | |
@image = image | |
end | |
def output_image | |
@image.each do |row| | |
row.each do |cell| | |
print cell # always puts a newline |
This file contains hidden or 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
class Image | |
def initialize(image) | |
@image = image | |
end | |
def output_image | |
@image.each do |row| | |
row.each do |cell| | |
print cell # always puts a newline |
This file contains hidden or 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 'pry' | |
class Image | |
def initialize(image) | |
@image = image | |
end | |
def output_image | |
@image.each do |row| | |
row.each do |cell| |
This file contains hidden or 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
class Node | |
attr_accessor :value, :next_node | |
def initialize(value, next_node=nil) | |
@value = value | |
@next_node = next_node | |
end | |
end | |
This file contains hidden or 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
module Luhn | |
def self.is_valid?(number) | |
result = Luhn.card_number_to_integer_array_from_string(number) | |
result = Luhn.reverse_to_start_from_right(result) | |
result = Luhn.double_every_second_digit(result) | |
result = Luhn.subtract_9_from_values_over_10(result) | |
sum = Luhn.sum_all_digits_of_array(result) | |
Luhn.luhn_is_valid?(sum) | |
end |
This file contains hidden or 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
function GetDocumentAsPdf(){ | |
Office.context.document.getFileAsync(Office.FileType.Pdf, {sliceSize: 65536}, | |
function (result) { | |
if (result.status == "succeeded") { | |
// If the getFileAsync call succeeded, then | |
// result.value will return a valid File Object. | |
var myFile = result.value; | |
var sliceCount = myFile.sliceCount; | |
var slicesReceived = 0, gotAllSlices = true, docdataSlices = []; | |
//app.showNotification("File size:" + myFile.size + " #Slices: " + sliceCount); |
This file contains hidden or 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
class CycleDetector | |
def initialize(list) | |
@tortoise = list | |
@hare = list.next_node if list | |
end | |
def self.detect(list) | |
self.new(list).detect | |
end |
OlderNewer