Skip to content

Instantly share code, notes, and snippets.

View chandermani's full-sized avatar

Chandermani chandermani

  • London
View GitHub Profile
{
"Id": "1-62472af4-2c5b5b25766186371734e751",
"Duration": 17.018,
"LimitExceeded": false,
"Segments": [
{
"Id": "46160f9f1396a63a",
"Document": {
"id": "46160f9f1396a63a",
"name": "DPAAS-PAY-SBX-BPME-OrderFunction",
@chandermani
chandermani / Heap.cs
Created May 26, 2021 18:40
C# heap implementation
using System;
using System.Collections.Generic;
using System.Text;
namespace DataStructures
{
public class Heap<T>
{
private T[] items;
private int size;
@chandermani
chandermani / introrx.md
Created July 11, 2020 08:51 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
private void PrintMatrix(int[][] matrix){
for(int i=0;i<matrix.Length;i++) {
for(int j=0;j<matrix[0].Length;j++) {
Console.Write(matrix[i][j] + " ");
}
Console.WriteLine("");
}
}
private void PrintMatrix(int[,] matrix){
@chandermani
chandermani / workout-history-tracker-v1.service.ts
Last active May 13, 2018 14:51
Workout History Tracker V1
import { CoreModule } from './core.module';
import { Injectable } from '@angular/core';
import { ExercisePlan } from '../workout-runner/model';
@Injectable({
providedIn: CoreModule
})
export class WorkoutHistoryTrackerService {
private maxHistoryItems = 20; // Tracking last 20 exercises
private currentWorkoutLog: WorkoutLogEntry = null;
@chandermani
chandermani / orderBy.ts
Created March 28, 2016 03:06
orderBy pipe in Angular2
@Pipe({
name: 'orderBy'
})
export class OrderByPipe {
transform(value: Array<any>, args: any[]): any {
let field: string = args[0];
if(value==null) {
return null;
}
if (field.startsWith("-")) {
@chandermani
chandermani / AuthHttp.ts
Last active February 14, 2021 12:48
Angular 2, Http service wrapper to pass authorization token with each request.
import {Injectable, EventEmitter} from 'angular2/core';
import {Http, Headers, RequestOptions, RequestOptionsArgs, Response, RequestMethod, Request, Connection, ConnectionBackend} from 'angular2/http';
import * as Rx from 'rxjs';
export enum Action { QueryStart, QueryStop };
@Injectable()
export class AuthHttp {
process: EventEmitter<any> = new EventEmitter<any>();
@chandermani
chandermani / dataaccess.cs
Created April 21, 2014 04:47
Fix PetaPoco DataReader error
var planEmployees = this.DB
.Query<Xhr.Data.Model.EmployeeLeavePlanView>("WHERE LeavePlanId=@0", p.Id)
.ToList(); //Did a ToList() to realize this query
// Same as it was earlier
@chandermani
chandermani / databaseacess
Created April 21, 2014 04:39
Multiple queries with PetaPoco
var planEmployees = this.DB
.Query<Xhr.Data.Model.EmployeeLeavePlanView>("WHERE LeavePlanId=@0", p.Id);
planEmployees.ForEach(e =>
{
var creditHistory = this.LeavesService.GetCredits(e.ID);
var newCredits = creditCalculator.CalculateNewCredits(processStartTime, creditHistory);
<input type="email"
ng-model='userEmail'
name='email' required
class="form-control"
custom-remote-validator="duplicate"
remote-validate-functions="duplicateMailRemoteCheck"
update-on-blur=""/>