Skip to content

Instantly share code, notes, and snippets.

Avatar

Sudipta Mondal sudiptamondal

View GitHub Profile
@sudiptamondal
sudiptamondal / read_json_in_macrocode.vb
Created Feb 25, 2020
Code snippet to loop through JSON data
View read_json_in_macrocode.vb
Dim jsonObject As Object, item As Variant
Set jsonObject = JsonConverter.ParseJson(strResponse)
For Each item In jsonObject
'do something with json object
Next item
@sudiptamondal
sudiptamondal / GET_REQ_VIA_MACRO.vb
Created Feb 25, 2020
Code Snippet to send GET Request via function in Excel Macro
View GET_REQ_VIA_MACRO.vb
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
@sudiptamondal
sudiptamondal / read_sql_fetch_cols.rb
Created Feb 25, 2020
Code snippet to fetch column names between select and from keyword to analyse.
View read_sql_fetch_cols.rb
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
View CreateNotif.java
notificationManager.notify("1001", builder.build());
View CreateNotif.java
final NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this);
View CreateNotif.java
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);
View CreateNotif.java
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);
}
}
@sudiptamondal
sudiptamondal / install_gem.sh
Last active Dec 19, 2015
MongoDB Class. Install mongo driver to connect with ruby source files. Part 1 - Install gem
View install_gem.sh
# 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
@sudiptamondal
sudiptamondal / run_server.sh
Created Jul 8, 2013
Complementing a tutorial video with ruby code. Part 3. Running the code
View run_server.sh
# just simply run the ruby file that we created.
ruby hello_world.rb
@sudiptamondal
sudiptamondal / hello_world.rb
Last active Dec 19, 2015
Complementing a tutorial video with ruby code. Part 2. Hello World
View hello_world.rb
# 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
You can’t perform that action at this time.