Skip to content

Instantly share code, notes, and snippets.

View anuraj's full-sized avatar
🏠
Working from home

Anuraj anuraj

🏠
Working from home
View GitHub Profile
@anuraj
anuraj / kmonitor
Last active August 29, 2015 14:15
using System;
using System.Diagnostics;
using System.IO;
namespace kmonitor
{
class Program
{
private static DateTime _lastRead = DateTime.MinValue;
using System;
using System.Text;
using System.IO;
using System.Net.Sockets;
using System.Net;
using System.Web.Mail;
namespace mySMTP
{
/// <summary>
/*! blanket - v1.1.9 */
if (typeof QUnit !== 'undefined'){ QUnit.config.autostart = false; }
(function(define){
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.acorn = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
// The main exported interface (under `self.acorn` when in the
@anuraj
anuraj / autocomplete.aspx
Created August 27, 2015 11:42
JQuery Autocomplete with Ajax using ASP.NET Web Methods
<%@ Page Language="C#" AutoEventWireup="true" %>
<script runat="server">
[System.Web.Services.WebMethod]
public static string[] GetData(string q)
{
var result = new[] { @"ActionScript", "AppleScript", "Asp", "BASIC", "C", "C++",
"Clojure", "COBOL", "ColdFusion", "Erlang","Fortran", "Groovy","Haskell",
"Java", "JavaScript", "Lisp", "Perl", "PHP", "Python","Ruby", "Scala", "Scheme" };
@{
ViewBag.Title = "Index";
}
<div class="gridster">
<ul>
@*<li id="widget1" data-row="1" data-col="1" data-sizex="1" data-sizey="1"></li>
<li id="widget2" data-row="2" data-col="1" data-sizex="1" data-sizey="1"></li>
<li id="widget3" data-row="3" data-col="1" data-sizex="1" data-sizey="1"></li>
<h1>This is a view component</h1>
<!--
Make sure the path is correct, Views > Shared > Components > [Component Name] > Default.cshtml
SampleApp2\Views\Shared\Components\HelloWorld\Default.cshtml
-->
@anuraj
anuraj / launch.json
Created January 1, 2018 13:59
Launching different browsers from VS Code
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (web)",
"type": "coreclr",
"request": "launch",
@anuraj
anuraj / Client.cs
Created June 17, 2016 08:21
Web socket example in ASP.NET Core
@{
ViewBag.Title = "Chat";
}
<input id="txtMessage" style="width:40%" />
<input id="cmdSend" type="button" value="Send" />
<input id="cmdLeave" type="button" value="Log out" />
<br />
@anuraj
anuraj / inspectcode.xslt
Last active July 5, 2018 05:12 — forked from maartenba/inspectcode.xslt
R# InspectCode XSLT
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
<xsl:key name="ISSUETYPES" match="/Report/Issues/Project/Issue" use="@TypeId"/>
<xsl:output method="html" indent="no"/>
<xsl:template match="/" name="TopLevelReport">
<html>
<head>
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet" />
<style>
body {font-family: 'Open Sans', sans-serif;}
@anuraj
anuraj / UsersController.cs
Last active July 25, 2019 04:54
EF Core - FirstOrDefaultAsync throws Null Reference Exception - Code sample to reproduce the issue.
public class UsersController : Controller
{
private readonly DatabaseContext _databaseContext;
public UsersController(DatabaseContext databaseContext)
{
_databaseContext = databaseContext;
}
public async Task<ActionResult<User>> Get(int id)
{