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 "Enter your statements separated by a carriage return, The matching braces will terminate the loop" | |
variables = Hash.new(Hash.new) | |
opening_brackets = 0 | |
closing_brackets = 0 | |
while true | |
variable = nil | |
level = nil | |
value = nil | |
input = gets.chomp |
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
# Steps | |
# 1. Install the gem sinatra | |
gem install sinatra | |
# you you skip rdoc and ri using | |
# gem install sinatra --no-rdoc --no-ri |
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
# hello_world.rb | |
# This will manage routes and display the content. | |
# I am sure, you did watch the video before checking this out. | |
require "sinatra" | |
set :bind, '127.0.0.1' | |
set :port, '8080' | |
get '/hello/:name' do |
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
# just simply run the ruby file that we created. | |
ruby hello_world.rb |
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
# Steps | |
# 1. Install the gem mongo | |
gem install mongo | |
gem install bson_ext | |
# bson_ext is for optimal performance of using mongodb. | |
# You can still use mongo without it. | |
# But then, it will throw a warning. | |
# you you skip rdoc and ri using | |
# gem install mongo --no-rdoc --no-ri |
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 'benchmark' | |
def smarter_way(unsorted_array, size, sorted_array) | |
maggic_array = Array.new(130) {|i| i = ({ i => 0 }) } | |
unsorted_array.each do |num| | |
maggic_array.each do |hash| | |
if hash.keys.first == num | |
hash[num] = hash[num] + 1 | |
end | |
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
private void createNotificationChannel() { | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { | |
NotificationChannel channel = new NotificationChannel("1000111", "cld_notif_channel", NotificationManager.IMPORTANCE_DEFAULT); | |
channel.setDescription("cld_notif_desc"); | |
NotificationManager notificationManager = getSystemService(NotificationManager.class); | |
notificationManager.createNotificationChannel(channel); | |
} | |
} |
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
final NotificationCompat.Builder builder = new NotificationCompat.Builder(this, "1000111") | |
.setContentTitle("Notification Title") | |
.setSmallIcon(R.drawable.ic_stat_name) | |
.setContentText("Notification Text") | |
.setPriority(NotificationCompat.PRIORITY_DEFAULT); |
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
final NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this); |
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
notificationManager.notify("1001", builder.build()); |
OlderNewer