Skip to content

Instantly share code, notes, and snippets.

View nonnb's full-sized avatar

Stuart Corrans nonnb

View GitHub Profile
using System;
using System.Collections.Generic;
using System.Linq;
using Moq;
using NUnit.Framework;
namespace WindowsFormsApplication3
{
public class CacheKeys
{
public List<StockQuote> parse()
{
return sqLoader
.getCSVFileContent()
.csvList.Skip(1)
.Select(line =>
{
var row = line.Split(',');
return new StockQuote
{
@nonnb
nonnb / gist:9fe9d3cd1f64e2cb5ee0
Created October 14, 2014 17:25
OM Dictionary vs Switch Function
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace TestProject1
{
public enum SomeStatusModeType
{
Status1,
@nonnb
nonnb / GROUP_CONCAT.cs
Last active August 29, 2015 14:11
Common Sql Clr Functions - GROUP_CONCAT with a delimiter, and Last occurrence String Replacement
// Minor modification of Microsoft's Concatenate function here http://msdn.microsoft.com/en-us/library/ms131056.aspx,
// by allowing for a different delimiter character. Note that default values aren't supported by SQLCLR Functions or Aggregates
using System;
using Microsoft.SqlServer.Server;
using System.Data.SqlTypes;
using System.IO;
using System.Text;
[Serializable]
namespace WebApplication4.Controllers
{
// Some POCO's
public class DesignParam
{
public string ParamID { get; set; }
}
public class Foo
{
public int ID { get; set; }
@nonnb
nonnb / Default.aspx
Last active August 29, 2015 14:12
http://stackoverflow.com/questions/27723127 - Creating a JSON Object from a VB.Net 3.5 ASMX WebMethod
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="WebApplication7._Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;
namespace ClassLibrary1
{
public static class SillyClass
// Yoav's Code
public void Test_GetNext()
{
Task t1 = Task.Factory.StartNew(() => { getSerial(); });
Task t2 = Task.Factory.StartNew(() => { getSerial(); });
Task t3 = Task.Factory.StartNew(() => { getSerial(); });
Task t4 = Task.Factory.StartNew(() => { getSerial(); });
Task t5 = Task.Factory.StartNew(() => { getSerial(); });
Task.WaitAll(t1, t2, t3, t4, t5);
@nonnb
nonnb / File1.cs
Last active August 29, 2015 14:23
SO 31035657 - Sparse Matrix Row and Column Sum performance
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using NUnit.Framework;
namespace ClassLibrary8
{
@nonnb
nonnb / gist:a2bd872fa50915635663
Created July 15, 2015 15:09
StackOverflow 31432943
using System.Collections.Generic;
using System.Linq;
using Moq;
using NUnit.Framework;
namespace DB
{
public class Person
{
public int PersonId { get; set; }