Skip to content

Instantly share code, notes, and snippets.

@gowon
gowon / anonymous-enumerable.cs
Last active August 12, 2022 07:06
Create an Enumerable for an Anonymous Type
var list = Enumerable.Empty<object>()
.Select(r => new {A = 0, B = 0}) // prototype of anonymous type
.ToList();
list.Add(new { A = 4, B = 5 }); // adding actual values
Console.Write(list[0].A);
@definitelynotsoftware
definitelynotsoftware / AngularJS-Windows-Authentication.authentication.js
Last active December 4, 2019 14:31
AngularJS Windows Authentication Service using .NET Web API and Hot Towel template
angular.module('app')
.factory("authentication", ["$http", "$q", "$window", authentication]);
function authentication($http, $q, $window) {
var user;
function login() {
// check if the user already exists for this session
@umidjons
umidjons / rows-contain-checked-checkbox.html
Created September 3, 2013 05:17
Select table rows that contain checked checkbox using jQuery
<!doctype html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Rows that contain checked checkbox</title>
</head>
<body>
<table class="_tm">
<thead>...</thead>
@asimjalis
asimjalis / csbat.md
Created December 8, 2012 02:01
How to use C# in bat and cmd files

How to use C# in bat and cmd files

by Asim Jalis, MetaProse.com

Here are the steps for how to write bat and cmd files with C#.

Here is the problem this solves: Frequently I just want to write a short C# snippet. I don't want to write it as a source file, compile it, and run it. I'd rather just put the snippet in a bat file and run the bat file. I want to shorten the code-compile-execute loop to just code-execute.

The following steps show you how to create CSBat.exe which solves this problem. Note: The in-memory compiler code was taken from Don Box's CSRepl from his blog.