๐ฅ Battle City 3 โ a game thatโs growing more popular every day
๐ฎ Online seasons, tank selection, and awesome rewards: grenades, enemy freeze, extra lives, and more
๐ New online levels are added regularly โ there's always something fresh to play!
๐ด Prefer offline? Enjoy 12 levels with selectable difficulty
๐ฒ Download now and jump into the battle!
๐๐๐
https://battlecity.udfsoft.com?from=tg_rubyI
https://battlecity.udfsoft.com?from=tg_rubyI
๐ฎ Online seasons, tank selection, and awesome rewards: grenades, enemy freeze, extra lives, and more
๐ New online levels are added regularly โ there's always something fresh to play!
๐ด Prefer offline? Enjoy 12 levels with selectable difficulty
๐ฒ Download now and jump into the battle!
๐๐๐
https://battlecity.udfsoft.com?from=tg_rubyI
https://battlecity.udfsoft.com?from=tg_rubyI
1๐ฉ6๐ฅ2
What will this code output?
puts "apple" < "banana"
puts "apple" < "banana"
Anonymous Quiz
59%
true
17%
false
4%
nil
19%
Error
Which HTTP method is used to partially update a resource?
Anonymous Quiz
14%
PUT
78%
PATCH
8%
UPDATE
0%
POST
Which status code means unauthorized access?
Anonymous Quiz
83%
401 Unauthorized
17%
403 Forbidden
1%
404 Not Found
0%
400 Bad Request
What does the HTTP status code 304 Not Modified mean?
Anonymous Quiz
5%
The resource was not found
85%
The resource has not changed since the last request
6%
The request was invalid
3%
The server is overloaded
๐ Understanding Ruby Blocks, Procs, and Lambdas
One of Rubyโs most elegant โ yet initially confusing โ features is its support for blocks, Procs, and lambdas. Mastering these is key to writing idiomatic and powerful Ruby code.
๐งฑ What is a Block?
A block is an anonymous piece of code that can be passed to a method.
If you call yield without a block, Ruby raises an error โ unless you check with block_given?.
๐ What is a Proc?
A Proc is a block saved into a variable.
You can pass Procs to methods, return them, and store them โ like any object.
๐ง What is a Lambda?
A lambda is a special kind of Proc with stricter argument checking and different return behavior.
Key differences:
- lambda enforces argument count (unlike Proc)
- return in a lambda exits only the lambda; in a Proc, it exits the method it's called from
๐ Proc vs Lambda: Subtle but Important
โ When to Use What?
- Use blocks for simple callbacks or iteration (e.g., each, map)
- Use Procs when you need to store logic to reuse
- Use lambdas when return behavior and argument count matter
๐น Learning to use blocks, Procs, and lambdas fluently is a big step toward writing expressive Ruby code.
#rubyonrails #codingtips
One of Rubyโs most elegant โ yet initially confusing โ features is its support for blocks, Procs, and lambdas. Mastering these is key to writing idiomatic and powerful Ruby code.
๐งฑ What is a Block?
A block is an anonymous piece of code that can be passed to a method.
def greet
yield
end
greet { puts "Hello from the block!" }
# => Hello from the block!
If you call yield without a block, Ruby raises an error โ unless you check with block_given?.
๐ What is a Proc?
A Proc is a block saved into a variable.
say_hello = Proc.new { puts "Hello!" }
say_hello.call
# => Hello!
You can pass Procs to methods, return them, and store them โ like any object.
๐ง What is a Lambda?
A lambda is a special kind of Proc with stricter argument checking and different return behavior.
greet = lambda { |name| puts "Hello, #{name}!" }
greet.call("Rubyist")
# => Hello, Rubyist!
Key differences:
- lambda enforces argument count (unlike Proc)
- return in a lambda exits only the lambda; in a Proc, it exits the method it's called from
๐ Proc vs Lambda: Subtle but Important
def test
proc = Proc.new { return "From Proc" }
proc.call
return "After Proc"
end
puts test
# => "From Proc" (method exited early)
def test_lambda
l = -> { return "From Lambda" }
l.call
return "After Lambda"
end
puts test_lambda
# => "After Lambda" (lambda returned only from itself)
โ When to Use What?
- Use blocks for simple callbacks or iteration (e.g., each, map)
- Use Procs when you need to store logic to reuse
- Use lambdas when return behavior and argument count matter
๐น Learning to use blocks, Procs, and lambdas fluently is a big step toward writing expressive Ruby code.
#rubyonrails #codingtips
1๐ฅ16๐2
What is the purpose of the HTTP header Content-Type?
Anonymous Quiz
10%
To specify the response status code
84%
To specify the media type of the resource or payload
4%
To authenticate the user
2%
To indicate the caching policy
What does this code output?
puts "๐" * 3
puts "๐" * 3
Anonymous Quiz
4%
๐3
88%
"๐๐๐"
1%
"3๐"
8%
Error
1๐2๐ฑ1
Which header controls cross-origin resource sharing (CORS)?
Anonymous Quiz
8%
Authorization
3%
User-Agent
87%
Access-Control-Allow-Origin
2%
Content-Length
Which of these is NOT a valid way to define a method in Ruby?
Anonymous Quiz
7%
def beach; "relax"; end
46%
def surf() "cool" end
42%
def 123sun; "hot"; end
5%
def chill(*args); "๐"; end
Whatโs the main drawback of monolithic architecture in Ruby on Rails applications?
Anonymous Quiz
2%
No database support
64%
Harder to test small parts of the system
30%
Ruby cannot scale monoliths at all
4%
Controllers cannot talk to models
Forwarded from Android frameworks
๐ก WiFi Temperature Sensor (ESP32 + DHT11)
A simple IoT temperature and humidity sensor based on ESP32-C3 and DHT11.
The device measures temperature and humidity, sends the data to a backend server, and from there it can be forwarded, for example, to a Telegram bot.
https://github.com/UDFSoft/Wifi-Temp-Sensor/
A simple IoT temperature and humidity sensor based on ESP32-C3 and DHT11.
The device measures temperature and humidity, sends the data to a backend server, and from there it can be forwarded, for example, to a Telegram bot.
https://github.com/UDFSoft/Wifi-Temp-Sensor/
1๐2โค1๐1
What is the main risk of using Active Record callbacks too much in a Rails application?
Anonymous Quiz
4%
They make SQL queries run faster.
86%
They hide business logic inside models and make code harder to follow.
5%
They prevent background jobs from running.
5%
They force controllers to duplicate logic.
What will this code print?
puts "2 + 2 = #{2 + 2}"
puts "2 + 2 = #{2 + 2}"
Anonymous Quiz
4%
2 + 2 = 2 + 2
3%
2 + 2 = 22
93%
2 + 2 = 4
1%
Error
In a distributed Ruby system, what is the biggest challenge of scaling via microservices?
Anonymous Quiz
6%
Choosing gems for each service.
8%
Deploying to a single server.
3%
Running Rails without a database.
82%
Network communication, consistency, and monitoring.
How do you create a hash in Ruby?
Anonymous Quiz
98%
{ name: "Alice", age: 25 }
0%
[ name: "Alice", age: 25 ]
2%
( name: "Alice", age: 25 )
0%
< name: "Alice", age: 25 >
Which header is used to send authentication tokens in REST APIs?
Anonymous Quiz
8%
Content-Type
1%
Accept
89%
Authorization
3%
Cookie
What does HTTP status code 201 Created mean?
Anonymous Quiz
3%
The request failed due to server error.
92%
A resource was successfully created.
2%
The resource was deleted.
3%
The request is still processing.