Skip to content

Instantly share code, notes, and snippets.

View stephensmitchell's full-sized avatar
🎯
Focusing

Stephen S. Mitchell stephensmitchell

🎯
Focusing
View GitHub Profile
@stephensmitchell
stephensmitchell / SimpleProgram.linq
Last active April 19, 2018 01:00 — forked from esride-apf/SimpleProgram.linq
LINQPad Samples #LINQPad
void Main()
{
var listOfI = GetInts();
foreach (var i in listOfI)
{
Console.WriteLine(i);
}
Console.WriteLine("******");
Console.WriteLine("jetzt 1-stellige");
@stephensmitchell
stephensmitchell / Recurse.cs
Last active April 19, 2018 01:00 — forked from alexander-williamson/Recurse.cs
Simple LinqPad example to hit an endpoint #LINQPad
// Needs System.Net;
// Prefer HttpClient for real situations other than testing
void Main()
{
while(true) {
try {
var url = "http://example.com/sub/dir/page.aspx?a=1234&b=something";
var request = (System.Net.HttpWebRequest) System.Net.WebRequest.Create (url);
var response = (System.Net.HttpWebResponse)request.GetResponse ();
@stephensmitchell
stephensmitchell / string-set-vs-set.cs
Last active April 19, 2018 01:00 — forked from meklarian/string-set-vs-set.cs
LINQPad snippet that declares two string arrays, spits out their mutually exclusive parts. #LINQPad
var set1 = new string[]{"a","b","c","d"};
var set2 = new string[]{"a","e","i","o","u"};
var q = set1.Except(set2);
Console.WriteLine(q.Count());
Console.WriteLine("");
foreach(string s in q)
{
Console.WriteLine(s);
@stephensmitchell
stephensmitchell / gist:95d1c341e8bae4dc2f5b1f9ed55267c7
Created April 17, 2018 16:54 — forked from liammclennan/gist:542cb1264305f525c70b
Partitioning events with Akka.net (linqpad - reference akka.net and Rx-main)
void Main()
{
var system = ActorSystem.Create("MySystem");
var greeters = system.ActorOf(Props.Create(() => new DeviceSplitter()));
var r = new System.Random();
var measures = Enumerable.Repeat(new [] {"a","b","c","d"}, 250000)
.SelectMany(c => c)
.Select (id => new Measure(id,r.Next()));
foreach (var m in measures) greeters.Tell(m);
Console.ReadLine();
@stephensmitchell
stephensmitchell / LpChart.linq
Last active April 19, 2018 01:01 — forked from amithegde/LpChart.linq
Quick and easy helper to render chars in LinqPad #LINQPad
<Query Kind="Program">
<Reference>&lt;RuntimeDirectory&gt;\System.Windows.Forms.DataVisualization.dll</Reference>
<Reference>&lt;RuntimeDirectory&gt;\System.Windows.Forms.dll</Reference>
<Namespace>System.Windows.Forms.DataVisualization.Charting</Namespace>
<Namespace>System.Drawing</Namespace>
<Namespace>System.Windows.Forms</Namespace>
</Query>
void Main()
{
@stephensmitchell
stephensmitchell / PerfCounterSample.cs
Last active April 19, 2018 01:01 — forked from RhysC/PerfCounterSample.cs
Linq Pad CPU usage C# program sample #LINQPad
void Main()
{
var instanceName = "LINQPad";
var counterCollectionInterval = TimeSpan.FromSeconds(1);
var continueCollectingTimeFrame = TimeSpan.FromSeconds(10);
var counters = from performanceCounterDefinition in PerformanceCounterRepository.GetPerfCounters
from counterName in performanceCounterDefinition.Counters
select new {
@stephensmitchell
stephensmitchell / GetDatabaseInfo.linq.cs
Last active April 19, 2018 01:00 — forked from jamesmanning/GetDatabaseInfo.linq.cs
LINQPad script to get basic schema information about the currently selected database (assumes LINQPad's default data context creation method) #LINQPad
void Main()
{
var databaseInfo = GetDatabaseInfo(this);
databaseInfo.Dump();
}
// Define other methods and classes here
public class DatabaseInfo
{
public Type DataContextType { get; set; }
@stephensmitchell
stephensmitchell / gist:5d701913024fe9fc5481331d9d8615a3
Last active April 19, 2018 01:00 — forked from ksummerlin/gist:963841
Here is a LinqPad example of KeyPressed e.Handled #LINQPad
//You'll have to run this example in LinqPad as a C# program.
//Or put a class around the two global methods and change .Dump() calls to Console.WriteLine
void Main()
{
var frm = new Form1();
frm.Controls[0].KeyPress += keypressed_inMain;
frm.ShowDialog();
}
NuGet.exe update m:\1.GitHub\TaxiSMS\CompleteSolution\CompleteSolution\CompleteSolution.sln -Id Newtonsoft.Json
@stephensmitchell
stephensmitchell / command_prompt
Last active April 19, 2018 00:58 — forked from about36km/command_prompt
NuGet Pack #Nuget
nuget pack Foo.xxproj -Prop Configuration=Release