Skip to content

Instantly share code, notes, and snippets.

@adamchester
adamchester / gist:9560154
Created March 15, 2014 00:52
git diff after win store target change
diff --git a/Octokit.Tests/OctoKit.Tests-NetCore45.csproj b/Octokit.Tests/OctoKit.Tests-NetCore45.csproj
index 351d930..00bf659 100644
--- a/Octokit.Tests/OctoKit.Tests-NetCore45.csproj
+++ b/Octokit.Tests/OctoKit.Tests-NetCore45.csproj
@@ -1,5 +1,5 @@
?<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuild
<PropertyGroup>
let whereNotExistsIn itemsToExclude itemToTest =
itemsToExclude |> Seq.exists (fun j -> itemToTest = j) |> not
let except itemsToExclude allItems =
allItems |> Seq.filter (whereNotExistsIn itemsToExclude)
[| "one"; "two"; "three"; |]
|> except [|"two"|]
|> Dump
@adamchester
adamchester / gist:cdabfc76d76c3a641698
Last active August 29, 2015 14:02
Except (faster; set-based)
let except ex all = all |> Seq.filter (not << Set.ofSeq(ex).Contains)
let filtered = [| 1..1000000 |] |> except [| 20..29 |]
@adamchester
adamchester / twitter_clients_2014.fsx
Created January 3, 2015 03:31
F# Community Twitter Clients (2014)
#I @"packages/"
#r @"FSharp.Data/lib/net40/FSharp.Data.dll"
#load @"FSPlot\FsPlotBootstrap.fsx"
#r @"Deedle\lib\net40\Deedle.dll"
do fsi.AddPrinter(fun (printer:Deedle.Internal.IFsiFormattable) -> "\n" + (printer.Format()))
open FSharp.Data
type Tweets = CsvProvider<"fsharp_2013-2014.csv">
open System
type WeekOf<'T> = { Mo:'T; Tu:'T; We:'T; Th:'T; Fr:'T; Sa:'T; Su:'T }
with
static member FromDays (allDays: (DayOfWeek * 'T)[]) =
let dayFor theDay = snd (allDays |> Array.find (fun (day, data) -> day = theDay))
{ Mo = dayFor DayOfWeek.Monday
Tu = dayFor DayOfWeek.Tuesday
We = dayFor DayOfWeek.Wednesday
Th = dayFor DayOfWeek.Thursday
@adamchester
adamchester / keybase.md
Created May 27, 2015 04:41
keybase proof

Keybase proof

I hereby claim:

  • I am adamchester on github.
  • I am adamchester (https://keybase.io/adamchester) on keybase.
  • I have a public key whose fingerprint is 6573 51C0 41D2 58D2 9BE8 83F1 835B 3087 94D3 EC6F

To claim this, I am signing this object:

@adamchester
adamchester / blog_welcome.blog.md
Created June 3, 2012 02:37
Welcome to my blog, it may be updated rarely
@adamchester
adamchester / blog_purpose.blog.md
Created June 17, 2012 13:26
This blog is purely a learning experience
@adamchester
adamchester / blog_test_assertion.testing.node.md
Created July 18, 2012 04:47
A simple test assertion DSL

Why?

I am not good at writing bug-free code in JavaScript or CoffeeScript. I am equally not good at writing bug-free tests. It would be nice to have a way to quickly build a basic 'safety net' for my code, and be able to describe the tests in a format less verbose than 'describe->it-should->etc'.

It should also be a good learning experience.

Goals

@adamchester
adamchester / blog_class_apply.coffeescript.md
Created July 25, 2012 03:27
How do you create a CoffeeScript class instance using 'apply'?

How do you create a CoffeeScript class instance using 'apply'?

The answer is, like this:

util = require('util')
assert = require('assert')

class MyClass
	constructor: (@splatArgs...) -&gt; @first = splatArgs[0]; @second = splatArgs[1]