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
Dim jsonObject As Object, item As Variant | |
Set jsonObject = JsonConverter.ParseJson(strResponse) | |
For Each item In jsonObject | |
'do something with json object | |
Next item |
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 Sub FetchData() | |
Dim objRequest As Object, strUrl As String, blnAsync As Boolean, strResponse As String | |
Dim jsonObject As Object, item As Variant | |
Set objRequest = CreateObject("MSXML2.XMLHTTP") | |
strUrl = "<URL_GOES_HERE>" | |
blnAsync = True | |
With objRequest | |
.Open "GET", strUrl, blnAsync |
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 analyse file_path | |
file = File.open(file_path, "r") | |
counter = 0 # counter for having a 2D Array | |
writefile = false | |
array = Array.new | |
file.readlines.each do |line| | |
if line.start_with? "SELECT" | |
writefile = true; | |
array[counter] = Array.new | |
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
notificationManager.notify("1001", builder.build()); |
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
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
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
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
# 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
# just simply run the ruby file that we created. | |
ruby hello_world.rb |