Skip to content

Instantly share code, notes, and snippets.

using System;
using System.Threading;
namespace ConsoleApplication2
{
class Program
{
public static void Main()
{
var action = new Action( MethodA).Timed(TimeSpan.FromSeconds(7));
using System;
namespace ConsoleApplication2
{
class Program
{
private static DateTime _lastInvoke = DateTime.MinValue;
public static void Main()
{
///
/// IF YOU LOOK HERE AND COMPARE THE 2 OUTPUT I PRINT THERE DIFFERENT BUT LOOKING AT THE FORMULA ON THE PAPER
/// http://www.ncbi.nlm.nih.gov/pmc/articles/PMC3622359/#ref40 IT LOOKS LIKE YOUR VARIABLES ARE IN THE WRONG ORDER
// actual formula from paper : E = DENSITY * Ein + (1 - DENSITY) * Eout
// Ein = reference variance thing where you use 4
// Eout is the water one which is 80.4
// these 2 forumlas below will give different results
public class Test
{
public int Width { get; set; }
}
public class Test2
{
private int _width;
public int GetWidth {
@battleguard
battleguard / AnonymousObserver.cs
Created December 4, 2015 22:45
Showing off the Observable Pattern
using System;
using System.Collections.Generic;
using System.Linq;
namespace ConsoleApplication2
{
public sealed class AnonymousObserver<T> : IObserver<T>
{
private readonly Action<T> _onNext;
private readonly Action<Exception> _onError;
@battleguard
battleguard / IRepository.cs
Last active November 13, 2015 22:09
Better version of ObservableCollection for c#
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
namespace Observables
{
public interface IRepository<T> : ICollection<T>, INotifyCollectionChanged
{
}
}
@battleguard
battleguard / AUTOMATED INSTALL README.txt
Last active October 30, 2015 19:50
Automated script for building osgearth and osg for visual studio
steps to build
1. download VS2013 3rd Party full or small for OSG from OSG's website (http://www.openscenegraph.org/index.php/download-section/dependencies)
2. download OSG's source (https://github.com/openscenegraph/osg)
3. download OsgEarth source (https://github.com/gwaldron/osgearth)
4. extract them all and setup directory structure as such (you can change this setup by modifying the envvars, but this is the default way)
- osgEarthinstallfolder
-- 3rdParty_x86_x64
-- osg
-- osgearth
@battleguard
battleguard / main.cpp
Created September 25, 2015 18:32
initial state of coordinateTranslation has the Y axis inverted.
#pragma once
#include <osgViewer\Viewer>
#include <osgEarthDrivers\gdal\GDALOptions>
#include <osgEarth\ImageLayer>
#include <osgEarth\MapNode>
#include <osgEarthUtil\EarthManipulator>
#include <iostream>
#include <osg\ShapeDrawable>
@battleguard
battleguard / C229-ReverseFizzBuzz.cs
Last active August 28, 2015 20:51
Reverse FizzBuzz Programming Challenge
using System;
using System.Collections.Generic;
using System.Linq;
using Xunit;
namespace _2015_08_03_E_Adding_Fractions.Intermediate
{
public class C229ReverseFizzBuzz
{
public class Key
Fixed point of f(x) = cos(x) where x = 3.00
count input output difference
1 3.000000 -0.989992 3.989993
2 -0.989992 0.548696 1.538689
3 0.548696 0.853205 0.304509
4 0.853205 0.657572 0.195634
5 0.657572 0.791479 0.133907
6 0.791479 0.702794 0.088685
7 0.702794 0.763039 0.060245
8 0.763039 0.722739 0.040300