Skip to content

Instantly share code, notes, and snippets.

@kenegozi
kenegozi / XunitConsoleForwarder.cs
Created Jun 25, 2017
Capturing console output in Xunit 2 tests
View XunitConsoleForwarder.cs
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using Xunit.Abstractions;
namespace MagicalUnicorns {
public class XunitConsoleForwarder : TextWriter {
private readonly ITestOutputHelper output;
@kenegozi
kenegozi / EnvThenConfigSettings.cs
Created Jun 1, 2015
Env based appSettings overrides, plus DictionaryAdapter fun
View EnvThenConfigSettings.cs
using System;
using System.Configuration;
using System.Collections;
using Castle.Components.DictionaryAdapter;
namespace Demo {
class MainClass {
public static void Main (string[] args) {
var ageString = (string)ConfigurationManager.AppSettings ["Age"];
View gist:38efab4ef3a810efb0d8
private func validateInputs() -> Bool {
let nonEmpty = {
(data:String!) -> Bool in
return count(data) != 0
}
func inRange (min: Int!, max:Int!) -> (String!) -> Bool {
return { (data:String!) -> Bool in
let dataAsInt = data.toInt()
return (dataAsInt! >= min && dataAsInt! <= max)
View keybase.md

Keybase proof

I hereby claim:

  • I am kenegozi on github.
  • I am kenegozi (https://keybase.io/kenegozi) on keybase.
  • I have a public key whose fingerprint is 4233 DAB9 6173 B1E4 E3D0 6263 B290 B45A ABB9 35CD

To claim this, I am signing this object:

@kenegozi
kenegozi / SimpleChannelPatterns.cs
Created Jan 16, 2015
Mimicking some of the samples from the talk "Go Concurrency Patterns" in c# (slides at https://talks.golang.org/2012/concurrency.slide#1) , to help illustrate the GO Channel concept to C# developers.
View SimpleChannelPatterns.cs
using System;
using System.Collections.Concurrent;
using System.Threading;
using System.Threading.Tasks;
namespace GoPatterns
{
class Program
{
static void Main()
View applicationhost
<add name="fcgi-golang" path="*.go" verb="*" modules="FastCgiModule" scriptProcessor="c:\w\playground\go-iis\std.exe" resourceType="Either" requireAccess="Read" />
<fastCgi>
<application fullPath="c:\w\playground\go-iis\std.exe"
arguments=""
maxInstances="1"
idleTimeout="300"
activityTimeout="30"
requestTimeout="90"
View humitemp1.ino
// Humidity and temperature monitor
// for Arduino UNO R3 (and probably most others)
// Main pieces:
// DHT11 humidity/temp sensor
// - mandatory 10k pull-up resistor
// -> using DHT.f by adafruit at https://github.com/adafruit/DHT-sensor-library
// 16x2 LCD
// - 10K potentiometer for contrast control
// - Push button and transistor for backlight control
// - 220ohm resistor to make the backlight a bit darker
@kenegozi
kenegozi / EditMyMobileServiceDataWithExcel.cs
Created Sep 7, 2012
Editing Azure Mobile Service data using Excel
View EditMyMobileServiceDataWithExcel.cs
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Windows.Forms;
using Microsoft.Office.Core;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Excel = Microsoft.Office.Interop.Excel;
@kenegozi
kenegozi / GistsResolver.cs
Created Sep 4, 2012
Given a gist embed script tag, get the gist's content
View GistsResolver.cs
public class GistsResolver {
public static string CreateContentForFeedFrom(string content) {
try {
return UnwrapGists(content, GetGist);
}
catch {
return content;
}
}
@kenegozi
kenegozi / MobileServices_WindowsPhone.cs
Created Aug 29, 2012
First glance on my unofficial Windows Phone SDK for Azure Mobile Services
View MobileServices_WindowsPhone.cs
// in App.xaml.cs
public partial class App : Application
{
public static readonly MobileServiceClient MobileServiceClient;
public static User CurrentUser;
static App()
{
// Get this data from the management portal's quickstart page
// in the 'connect to existing apps' section
You can’t perform that action at this time.