Instantly share code, notes, and snippets.

View gist:5357462
int main(int argc, char *argv[]) {
int n=50;
float h=0.1;
float y[n];
float x[n];
x[0]=0;
x[1]=h;
y[0]=1;
y[1]=1-h;
printf("x %d\n", x[0]);
View Settings.StyleCop
<StyleCopSettings Version="105">
<Parsers>
<Parser ParserId="StyleCop.CSharp.CsParser">
<ParserSettings>
<BooleanProperty Name="AnalyzeDesignerFiles">False</BooleanProperty>
<CollectionProperty Name="GeneratedFileFilters">
<Value>\.g\.cs$</Value>
<Value>TemporaryGeneratedFile.*\.cs$</Value>
<Value>\.g\.i\.cs$</Value>
</CollectionProperty>
View gist:3193533
// Copyright (c) 2011 Claus Jørgensen <thedeathart@gmail.com>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
View gist:2949529
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
namespace ConsoleApplication8
{
class Program
{
View gist:2871084
Method:
private Task<TextMessage> SendMessageToServiceAsync(TextMessage message)
{
var tcs = new TaskCompletionSource<TextMessage>();
SendMessageToService(message, (msg) => tcs.SetResult(msg));
return tcs.Task;
}
View gist:1981492
class Test<PageType> : DbContext
where PageType : class
{
private Dictionary<Type, PageType> callbacks = new Dictionary<Type, PageType>();
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
foreach (var type in callbacks.Keys)
View gist:1703785
public class MeterTestDataContext : DbContext, IMeterTestDataContext
{
public MeterTestDataContext(string fileOrServerOrConnection)
: base(fileOrServerOrConnection)
{
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
View gist:1682683
using System;
using System.Collections.Generic;
using System.IO;
namespace Kamstrup.Communication
{
/// <summary>
/// Package for reading the values of one or more registers.
/// </summary>
public class ReadRegistersCommand : ReadCommand<ICollection<MeterRegister>>
View gist:1633127
#pragma warning disable 0809
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
public class Base
{
View GeoLocationHelper.cs
public static class GeoLocationHelper
{
public static GeoCoordinate ToWGS84(double x, double y)
{
var axis = 6378137.0;
var flattening = 1.0 / 298.257222101;
var centralMeridian = 15.0 + 48.0 / 60.0 + 22.624306 / 3600.0;
var scale = 1.00000561024;
var falseNorthing = -667.711;
var falseEasting = 1500064.274;