Skip to content

Instantly share code, notes, and snippets.

View ydsood's full-sized avatar
🐛
Metamorphosing

Yadvaindera Sood ydsood

🐛
Metamorphosing
View GitHub Profile
@ydsood
ydsood / ExpEvaluator.js
Created September 14, 2019 03:13
Evaluate BODMAS mathematical expressions in JavaScript. Using Shunting Yard Algorithm by Edgar Dijkstra.
//Refereces
// 1. https://www.geeksforgeeks.org/expression-evaluation/
// 2. https://en.wikipedia.org/wiki/Shunting-yard_algorithm
/*
* Usage : var x = new ExpEvaluator().evaluate('100 * ( 2 + 12 )') : 1400
*/
class ExpEvaluator{
determineOperatorPrec(x,y){
<?php
final class PhabricatorStandardCustomFieldSelect
extends PhabricatorStandardCustomField {
//***************//
//Existing Code here
//**************//
/*
@ydsood
ydsood / TowersOfHanoi.cs
Last active July 13, 2018 02:38
Towers of Hanoi solver using c#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Text;
namespace TowersOfHanoi
{
public class Program
{
@ydsood
ydsood / Question
Created July 12, 2018 21:12
Question for stack overflow
I have been reading through the sample for [Cookie][1] based auth implementation by the ASP .NET core team. When I implemented a similar startup.cs file and tried to login I get a runtime exception
`InvalidOperationException: No authentication handler is configured to handle the scheme: Cookies`
How am I supposed to configure an application handler to validate my cookies?
Here's my code for reference.
**Configure method from Startup.cs**
@ydsood
ydsood / Private Properties on objects .js
Last active April 16, 2020 16:15
JavaScript private properties and singleton
// Creating object with frozen properties that cannot be modified once initialized
// Useful for singleton and for implementing private properties that can be protected from malicious
// or unintended modifications
sessionStorage.setItem('doNotChangeValue') = 123;
const propProvider = (function(){
let A = -1;
let B = 'someValue';
let C = sessionStorage.getItem('doNotChangeValue');
return{
getPropA : function(){
@ydsood
ydsood / Karatsuba.cs
Created June 8, 2018 22:16
Karatsuba Integer Multiplication implementation in C#.
using System;
namespace IntegerMultiplication
{
class Karatsuba
{
static void Main(string[] args)
{
Console.Write(new Karatsuba().multiply(args[0], args[1]));
Console.Read();