Skip to content

Instantly share code, notes, and snippets.

View harishrathi's full-sized avatar

Harish Rathi harishrathi

  • AlgoSys Tech
  • Pune
View GitHub Profile
@harishrathi
harishrathi / angular-configurator.cs
Created April 25, 2020 14:34
dotnet core - angular - npm start
var solutionDir = Directory.GetParent(env.ContentRootPath).FullName;
spa.Options.SourcePath = Path.Join(solutionDir, "ICollect.Public.ClientApp");
spa.UseAngularCliServer("start");
@harishrathi
harishrathi / custom-date-adapater.ts
Created August 7, 2019 07:48
custom-date-adapater.ts
import { Injectable } from '@angular/core';
import { NativeDateAdapter } from '@angular/material';
import { format as formatFns } from 'date-fns';
// https://github.com/angular/components/blob/9eeb4b5aa0473c0815a73bfe3c2ed6164d86a3b3/src/material/core/datetime/native-date-formats.ts
// https://github.com/angular/components/blob/fde980c8ad57a803c7bf6ca0d909cedccc354f06/src/material/core/datetime/native-date-adapter.ts
export const MAT_CUSTOM_DATE_FORMATS = {
parse: {
dateInput: 'yyyy-MM-dd',
},
@harishrathi
harishrathi / date-fns-date-adapter.ts
Last active August 7, 2019 07:47 — forked from JoniJnm/date-fns-date-adapter.ts
date-fns angular material adapter
import { Injectable } from '@angular/core';
import { DateAdapter } from '@angular/material';
import { addDays, addMonths, addYears, getDate, getDaysInMonth, getMonth, getYear } from 'date-fns';
import { format, parse, setDay, setMonth, toDate, Locale } from 'date-fns';
import { enUS } from 'date-fns/locale';
export const MAT_DATE_FNS_DATE_FORMATS = {
parse: {
dateInput: 'yyyy-MM-dd',
},
https://stackblitz.com/edit/ngx-formly-flex-layout
https://stackblitz.com/edit/ngx-formly-flex-layout-ntx9fe
@harishrathi
harishrathi / dashboard.html
Last active July 3, 2019 07:13
angular-file-upload-control
<form [formGroup]="form">
<formly-form [model]="model" [fields]="fields" [form]="form"></formly-form>
</form>
<pre>{{model | json}}</pre>
<pre>invalid: {{form.invalid}}</pre>
<pre>errors: {{form.errors | json}}</pre>
import { TestBed } from '@angular/core/testing';
import { AllocationRoutingService } from './allocation-routing.service';
describe('AllocationRoutingService', () => {
beforeEach(() => TestBed.configureTestingModule({}));
it('should be created', () => {
const service: AllocationRoutingService = TestBed.get(AllocationRoutingService);
expect(service).toBeTruthy();
private void ValidationConfiguration()
{
var fields = this.Fields.Select(x => x.Key).ToList();
var duplicateFields = fields.GroupBy(x => x)
.Where(g => g.Count() > 1)
.Select(y => y.Key)
.ToList();
if (duplicateFields.Count > 0)
{
var result = string.Join(',', duplicateFields);
mkdir -p ~/Documents/WindowsPowerShell
New-Item -Type file ~/Documents/WindowsPowerShell/Microsoft.PowerShell_profile.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco feature enable --name=allowGlobalConfirmation
choco install googlechrome
choco install 7zip
choco install adobereader
# set strong cryptography on 64 bit .Net Framework (version 4 and above)
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NetFramework\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -Type DWord
# set strong cryptography on 32 bit .Net Framework (version 4 and above)
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\.NetFramework\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -Type DWord
$dirName=[System.IO.Path]::GetDirectoryName($profile)
if(!(Test-Path $dirName))
{
Write-Host "creating profile directory: $dirName"
New-Item -ItemType directory -Path $dirName
}
if (!(Test-Path $profile))
{