Skip to content

Instantly share code, notes, and snippets.

View giridharprakash's full-sized avatar

Giridhar Prakash giridharprakash

View GitHub Profile
@giridharprakash
giridharprakash / introrx.md
Created April 15, 2016 17:22 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@giridharprakash
giridharprakash / web.config
Created February 14, 2017 15:08
node web application deployment to IIS. this is for blog post.
<configuration>
<system.webServer>
<handlers>
<add name="iisnode" path="app.js" verb="*" modules="iisnode" />
</handlers>
<rewrite>
<rules>
<rule name="sample">
<match url="/*" />
@giridharprakash
giridharprakash / web.config
Created February 14, 2017 15:15
deploy node web application to IIS. this is blog post
<configuration>
<system.webServer>
<handlers>
<add name="iisnode" path="server/index.js" verb="*" modules="iisnode" />
</handlers>
<rewrite>
<rules>
<rule name="sample">
<match url="api/*" />
@giridharprakash
giridharprakash / Program.cs
Last active April 14, 2017 15:19
Save xml content in Sql Server using entity framework
namespace EntityFrameworkXmlDemo
{
internal class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Welcome");
bool retrieve = true;
var context = new SampleContext("connection string here");
@giridharprakash
giridharprakash / service.ts
Last active August 18, 2017 17:54
Send JSON in Http Get request with Angular.
import {Http, Headers, RequestOptions, Response, ResponseContentType, URLSearchParams} from "@angular/http";
@Injectable()
export class DocumentService
{
constructor(private http: Http)
{
}
loadDocuments(folderId: number, currentPage: number) : Observable<Response>
@giridharprakash
giridharprakash / documentViewer.ts
Created August 21, 2017 15:32
Load pdf stream and show it in ionic app.
import {File} from '@ionic-native/file';
import { DocumentViewer } from '@ionic-native/document-viewer';
export class DocumentViewer
{
constructor(private file : File, private documentViewer: DocumentViewer)
{
}
public openDocument(document: Document)
@giridharprakash
giridharprakash / code-coverage.js
Created December 20, 2019 03:22
Code coverage script for .net core projects
var commandExists = require('command-exists');
const execSync = require('child_process').execSync;
const rimraf = require('rimraf');
function runCoverageReport() {
console.log('started code coverage');
rimraf.sync('TestResults');
let result = execSync('dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:CoverletOutput=./TestResults/');
console.log(result.toString());
console.log('finished code coverage');
public static IServiceCollection InitDatabaseContext(this IServiceCollection services, string connectionString)
{
services.AddDbContext<AppDbContext>(opts =>
{
opts.UseSqlServer(connectionString);
opts.ReplaceService<IConventionSetBuilder, CustomSetBuilder>();
});
return services;
}
@giridharprakash
giridharprakash / EmailBackgroundService.cs
Created April 6, 2020 00:07
dotnet core background hosted service with dependency injection and runs every 5 seconds
public class EmailBackgroundService : BackgroundService
{
private readonly IServiceProvider _serviceProvider;
private readonly ILogger<EmailBackgroundService> _logger;
public EmailBackgroundService(IServiceProvider serviceProvider, ILogger<EmailBackgroundService> logger)
{
_serviceProvider = serviceProvider;
_logger = logger;
}