Skip to content

Instantly share code, notes, and snippets.

View santoshtechwiz's full-sized avatar

santosh kumar singh santoshtechwiz

View GitHub Profile
@santoshtechwiz
santoshtechwiz / code.cs
Created June 12, 2021 04:36
CodeGuru-MediatR
void Main()
{
CreateWebHostBuilder(new string[] { "" }).Build().Run();
}
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>();
@santoshtechwiz
santoshtechwiz / AND_OR_NOT
Created June 7, 2021 05:22 — forked from oliverdoetsch/AND_OR_NOT
Blogger: Globally conditional data tags for all page types
#AND
<b:if cond='data:blog.pageType == "index"'>
<b:if cond='data:blog.searchQuery'>
<!--search_page AND index_page-->
</b:if>
</b:if>
#OR
@santoshtechwiz
santoshtechwiz / jquery-mock.js
Created April 26, 2021 14:05 — forked from dbalduini/jquery-mock.js
JQuery stub and mock with Sinon for Unit Tests
(function () {
'use strict';
var sinon = require('sinon');
var keys = ['closest', 'addClass', 'children', 'parent', 'find', 'html',
'remove', 'text', 'ready', 'unveil', 'removeAttr', 'removeClass', 'scroll',
'val', 'height', 'css', 'delay', 'queue', 'dequeue', 'attr'];
function JQueryStub (args) {
var self = this;
@santoshtechwiz
santoshtechwiz / RequestsInParallel.cs
Created July 25, 2020 12:24 — forked from LukeTillman/RequestsInParallel.cs
Async Requests in Parallel
// Use a prepared statement for all the INSERTs
PreparedStatement prepared = session.Prepare("INSERT INTO sometable (column1, column2) VALUES (?, ?)");
// Create a list to hold in flight requests
var requestList = new List<Task>();
// Assume you have some collection of data that needs to be inserted
foreach(var data in dataToInsert)
{
// Provide data values to be inserted with our prepared statement for this piece of data
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: Consolas, "Courier New", Courier, Monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
const local = document.getElementById('local');
const remote = document.getElementById('remote');
const callBtn = document.getElementById('call');
let localStream = null;
let pc1;
let pc2;
navigator.mediaDevices.getUserMedia({ audio: true, video: true })
.then(stream => {
local.srcObject = stream;
@santoshtechwiz
santoshtechwiz / NQuee.ts
Created April 29, 2019 07:19
Nqueen Implementation in typescript
function createBoard(n: number) {
let board = [];
for (let i = 0; i < n; i++) {
board[i] = [];
for (let j = 0; j < n; j++) {
board[i][j] = 'x';
}
}
board;
@santoshtechwiz
santoshtechwiz / webcrawler.cs
Created January 1, 2019 17:58 — forked from icanhasjonas/webcrawler.cs
Web Crawler in C#
using System;
using System.Buffers;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
void Main()
{
Mapper.Reset();
Mapper.Initialize(cofig =>
{
cofig.CreateMap<Event, EventDTO>(); // maps message and event id
cofig.CreateMap<EventLog, EventDTO>(); // maps system id and user id
cofig.CreateMap<EventLog, IEnumerable<EventDTO>>()
.ConvertUsing<EventLogConverter>(); // creates collection of dto