Skip to content

Instantly share code, notes, and snippets.

Avatar
🐌
Not only working software but also well crafted software.

Dattatray Kale way2datta

🐌
Not only working software but also well crafted software.
View GitHub Profile
@way2datta
way2datta / Elvis.kt
Created September 11, 2021 14:05
Elvis operator in Kotlin
View Elvis.kt
fun main(args: Array<String>) {
val arnav = Person();
println(arnav);
arnav.name = "Arnav Kale";
println(arnav);
}
class Person {
var name: String? = null
override fun toString(): String {
@way2datta
way2datta / BinarySearch.cs
Last active July 9, 2021 05:28
Human Readable Binary Search
View BinarySearch.cs
public class IntArray
{
public static int BinarySearch(int[] items, int searchTerm)
{
return SearchRecursively(items, searchTerm, 0, items.Length - 1);
}
private static int SearchRecursively(int[] items, int searchTerm, int lowerIndex, int upperIndex)
{
var scannedAllItems = lowerIndex > upperIndex;
@way2datta
way2datta / SampleForRunningManyProgramsAtOnce.cs
Last active July 8, 2021 06:26
This program will be used to show "Running Many Programs At Once"
View SampleForRunningManyProgramsAtOnce.cs
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Security;
using System.Threading;
internal class Program
{
[DllImport("Kernel32.dll"), SuppressUnmanagedCodeSecurity]
public static extern int GetCurrentProcessorNumber();
@way2datta
way2datta / ViolateImmurable.cs
Created July 12, 2020 06:54
Protect Your Immutable Object Invariants
View ViolateImmurable.cs
public class Student
{
public readonly string Name;
public readonly string Email;
public readonly List<String> Subjects;
public Student(string name, string email, List<String> subjects)
{
@way2datta
way2datta / gist:0c6d460948411dd69962944119b12522
Created November 7, 2019 11:27
Links for technical reading
View gist:0c6d460948411dd69962944119b12522
How browsers work - Behind the scenes of modern web browsers: http://taligarsiel.com/Projects/howbrowserswork1.htm
@way2datta
way2datta / gst-calculator-long-method.js
Last active August 21, 2019 06:11
GST Calculator long method example
View gst-calculator-long-method.js
using System;
using System.Collections.Generic;
namespace NMart.Billing
{
internal class NMartStore
{
private static Dictionary<string, int> CategoryGstRatesInPercentage = new Dictionary<string, int>();
private static Dictionary<string, string> ItemsCategoryMapping = new Dictionary<string, string>();
@way2datta
way2datta / flag-argument.js
Last active December 27, 2018 17:52
Login to the system and send access code via email or sms notifications.
View flag-argument.js
function login(email, password, sendEmail, sendSMS) {
// logic for user authentication
this.authenticate(username, password);
// logic to fetch user, access code, message content, settings login token in storage
if(sendEmail) {
// logic to send access code via email
}
if(sendSMS) {
@way2datta
way2datta / ExpenseTracker.txt
Created November 25, 2018 15:14
Simple Expense tracker application for study purpose
View ExpenseTracker.txt
**Use Cases**
- User can register his/her account.
- An account owner can log into the system.
- An account owner can view, add, update, and delete category for expenses.
- An account owner can view, add, update, and delete expense.
@way2datta
way2datta / list-urls-and-verbs-in-restful-service.js
Created November 22, 2018 04:27
List down endpoints urls and http verbs that was built by using Node + Express
View list-urls-and-verbs-in-restful-service.js
const express = require('express');
import routes from './routes/rest-api';
const app = express();
const port = 3000;
const hostUrl = "http://localhost:3000"
app.use('/', routes);
routes.stack.forEach(function (element) {
@way2datta
way2datta / Poorly formatted and poorly named urls and http methods
Last active November 21, 2018 15:33
Poorly formatted and poorly named urls and http methods
View Poorly formatted and poorly named urls and http methods
HTTP GET http://localhost:3000/userJWTValidation
HTTP GET http://localhost:3000/JwtValidation
HTTP GET http://localhost:3000/creationOfUserDetails
HTTP GET http://localhost:3000/getAllusersDetails
HTTP GET http://localhost:3000/fetchUserDetails
HTTP GET http://localhost:3000/deletionOfUserDetails
HTTP GET http://localhost:3000/updationOfUserDetails
HTTP GET http://localhost:3000/getExpenseCategoryOfUsers
HTTP GET http://localhost:3000/getExpenseCategoryOfUser
HTTP GET http://localhost:3000/deletionExpenseCategoryOfUser