Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.2/angular.min.js"></script>
<script>
var app = angular.module('app', []);
app.controller('uploadController', function($scope) {
$scope.fileChanged = function (element) {
using Raven.UnitTest.Support;
using System;
using System.Linq;
using Xunit;
namespace Raven.UnitTest
{
public class MessageBuilderTest
{
private readonly MessageBuilder sut;
/*
Instead of repeating cross-cutting concerns in every function, we
can use the "doWork" function as an abstraction.
*/
var work = function(){
console.log("working hard");
};
var doWork = function(func){
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace Surveillance
{
public class Keyboard : IObservable<Keys>, IDisposable
{
private IntPtr callbackHandle;
**Set up the Project**
1. In Visual Studio, create an Windows Forms Application.
2. In Solution Explorer, right-click the project, select Add | Class. Name the class HotkeyManager.cs and add it to the project.
**Note:** In this tutorial we will place all of our code files in one code file.
3. Replace the code in the new HotkeyManager class with the following code.
4. In the Solution explorer, open the `Form1.cs` class emitted by Visual Studio.
5. Replace the default code in the class with the following code.
public class CheckoutTest
{
[Fact]
public void PlaceOrder_ReturnsCorrectMessage()
{
Checkout sut = new Checkout();
string actual = sut.PlaceOrder("bfc");
string expected =
"The order is\r\n" +
" burger: 1\r\n" +
public class LinkedListNode<TNode>
{
public TNode Value
{
get;
set;
}
public LinkedListNode<TNode> Next
{
@AlexArchive
AlexArchive / howtorunfsx.md
Created September 21, 2014 11:45
How to fun F# Script | How to execute .fsx

This section shows you how to associate scripts with F# Interactive on Windows 8.

Note: These steps only take a minute to complete, and you only have to carry them out once.

  1. Download the script to your directory of choice.
  2. Right-click the script, select Open with > Choose default program.
  3. You should be presented with a white window. Click More Options then scroll down and click Look for another app on this PC.
  4. You should then be prompted with an explorer window. Navigate to C:\Program Files (x86)\Microsoft SDKs\F#\<version>\Framework\<version> where <version> is the highest present version number.
  5. Double click Fsi.exe.
  6. You should now be able to run the script as though it were a conventional executable.
let coins = [
"quarter", 0.25m;
"dime", 0.10m;
"nickel", 0.05m;
"penny", 0.01m
]
let rec giveChange (change : decimal) =
let coin = coins |> List.tryFind (fun (_, coinValue) -> change >= coinValue)
match coin with
@AlexArchive
AlexArchive / Program.cs
Created September 8, 2014 22:51
Mutating Expression Tree
public class Program
{
private static void Main()
{
var operandOne = Expression.Parameter(typeof (int));
var operandTwo = Expression.Parameter(typeof(int));
var expression =
Expression.Lambda(
Expression.Add(