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 | |
class FFMPEG | |
def self.generate_filter | |
scale_segment = '' | |
ingredients.each_with_index do |_, i| | |
scale_segment += "[#{i}:v]scale=1920:1080:force_original_aspect_ratio=1[v#{i}];" | |
end | |
output_segment = '' |
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
Update( | |
Select( | |
"ref", | |
Get( | |
Match( | |
Index("title_unique"), | |
"TITLE HERE " | |
) | |
) | |
), |
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/ruby | |
DATA.each_line do |line| | |
puts line | |
end | |
__END__ | |
Doom | |
Quake | |
Diablo |
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_of_dir/* | |
e.g. | |
-*/app/*,-*/.bundler/* |
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
["john", "alice", "philip"] | |
=> ["john", "alice", "philip"] | |
arr.map!(&:freeze).freeze | |
=> ["john", "alice", "philip"] | |
arr.map(&:downcase!) | |
FrozenError: can't modify frozen String | |
from (pry):3:in `downcase!' | |
arr.map!(&:downcase) | |
FrozenError: can't modify frozen Array | |
from (pry):4:in `map!' |
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
arr = ["john", "alice", "philip"] | |
=> ["john", "alice", "philip"] | |
arr.map!(&:upcase) # works, array not frozen | |
=> ["JOHN", "ALICE", "PHILIP"] | |
arr | |
=> ["JOHN", "ALICE", "PHILIP"] | |
arr.freeze | |
=> ["JOHN", "ALICE", "PHILIP"] | |
arr.map!(&:downcase) # doesnt work, array is frozen | |
FrozenError: can't modify frozen Array |
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 fridge_1_contents | |
@fridge_1_contents ||= [1].freeze | |
end | |
def fridge_2_contents | |
@frigde_2_contents ||= [2].freeze | |
end | |
fridge_3_contents = fridge_1_contents + fridge_2_contents | |
=> [1, 2] |
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 set_of_elements_1 | |
[1].freeze | |
end | |
def set_of_elements_2 | |
[2].freeze | |
end | |
set_of_elements_3 = set_of_elements_1 + set_of_elements_2 |
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
[1] pry(main)> A = [1].freeze | |
=> [1] | |
[2] pry(main)> A << 2 | |
FrozenError: can't modify frozen Array | |
from (pry):2:in `__pry__' |
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
[1] pry(main)> A = [1] | |
=> [1] | |
[2] pry(main)> A.object_id | |
=> 70348956801400 | |
[3] pry(main)> A << 2 | |
=> [1, 2] | |
[4] pry(main)> A | |
=> [1, 2] | |
[5] pry(main)> A.object_id | |
=> 70348956801400 |
NewerOlder