Skip to content

Instantly share code, notes, and snippets.

@jwood803
jwood803 / mlnet.cs
Created June 18, 2018 19:38
ML.NET Test
using System;
using Microsoft.ML.Models;
using Microsoft.ML.Runtime;
using Microsoft.ML.Runtime.Api;
using Microsoft.ML.Trainers;
using Microsoft.ML.Transforms;
using System.Collections.Generic;
using System.Linq;
using Microsoft.ML;
using Microsoft.ML.Data;
@jwood803
jwood803 / IEnumerable ForEach
Last active June 7, 2017 03:03
IEnumerable ForEach extension
static class Extensions
{
public static void ForEach<T>(this IEnumerable<T> source, Action<T> action)
{
foreach (var item in source)
{
action(item);
}
}
}
@jwood803
jwood803 / emoji_test.rb
Last active June 12, 2017 14:07 — forked from holman/emoji_test.rb
Ruby code to test blog posts.
require_relative "test_helper"
require "open-uri"
require "net/http"
class EmojiTest < Blog::Test
def test_no_emoji
posts.each do |post|
content = File.read(post)
refute_match /:[a-zA-Z0-9_]+:/, content,
#I "../packages/SQLProvider.0.0.9-alpha/lib/net40"
#r "System.Data.dll"
#r "FSharp.Data.TypeProviders.dll"
#r "System.Data.Linq.dll"
open System.Data
open System.Data.Linq
open Microsoft.FSharp.Data.TypeProviders
open System
open System.IO
Environment.CurrentDirectory <- __SOURCE_DIRECTORY__
if not (File.Exists "paket.exe") then
let url = "https://github.com/fsprojects/Paket/releases/download/0.27.2/paket.exe"
use wc = new Net.WebClient()
let tmp = Path.GetTempFileName()
wc.DownloadFile(url, tmp)
@jwood803
jwood803 / sqlProvider.fs
Created February 10, 2015 13:33
Sql Provider
#I "../packages/SQLProvider.0.0.9-alpha/lib/net40"
#r "FSharp.Data.SqlProvider.dll"
open FSharp.Data.Sql
type sql = SqlDataProvider<ConnectionString = @"Server=JONWOOD4DDE\SQLEXPRESS;Database=northwind;Trusted_Connection=True",
DatabaseVendor = Common.DatabaseProviderTypes.MSSQLSERVER,
UseOptionTypes = true>
let context = sql.GetDataContext()
@jwood803
jwood803 / FSharpBankAccount.fs
Last active November 1, 2017 21:01
Code examples for F# in the Enterprise blog post.
type BankAccount() =
member val Balance = Option<float>.None with get, set
member this.openAccount() =
this.Balance <- Some 0.0
this.Balance.Value
member this.closeAccount() =
this.Balance <- None
@jwood803
jwood803 / Stock.cs
Last active January 3, 2016 09:59
Observer pattern implementations in .NET
public class Stock
{
public string Symbol { get; set; }
public double Price { get; set; }
public DateTime DateRecieved { get; set; }
}
@jwood803
jwood803 / chaining.md
Last active January 2, 2016 10:29
Ruby examples
puts "Ruby".downcase.upcase.reverse

Result

YBUR

General

  1. Unit tests: Review unit tests first. Unit tests are a fantastic way to grasp how code is meant to be used by others and to learn what the expected behavior is. Are there any test gaps that should be there?
  2. Method arguments" Make sure arguments to methods make sense and are validated.
  3. Null References" (Yah yah, we know. Use F# and this goes away. We get it already.) Null references are a bitch and it’s worth looking out for them specifically.
  4. Conventions Consistency" Make sure naming, formatting, etc. follow our conventions and are consistent. I like a codebase that’s fairly consistent so you know what to expect.
  5. Disposables: Make sure disposable things are disposed. Look for usages of resources that should be disposed but are not.
  6. Security: There is a whole threat and mitigation review process that falls under this bucket.

WPF + ReactiveUI