This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void ExampleMethod() | |
{ | |
object a = new object(); | |
object b = new object(); | |
// | |
a = null; | |
b = null; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Program { | |
public static event EventHandler listener; | |
static void Main(string[] args) { | |
string input = ""; | |
bool ended = false; | |
while (!ended) { | |
Console.WriteLine("type in command: "); | |
input = Console.ReadLine(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Program.listener -= new EventHandler(Some); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[<TestMethod>] | |
member this.``Test live cell with no neighbors dies``() = | |
[| | |
[|1; 0; 0|]; | |
[|0; 0; 0|]; | |
[|0; 0; 0|] | |
|] | |
|> Game.Step | |
|> should equal [| | |
[|0; 0; 0|]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[<TestMethod>] | |
member this.``Test left upper corner neighbors is 3``() = | |
(0, 0, [| | |
[|0; 1; 0|]; | |
[|1; 1; 0|]; | |
[|0; 0; 0|] | |
|]) | |
|> Game.NeighborsAt | |
|> should equal 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static member NeighboursAt(x : int, y: int, states : int [][]) : int = | |
[for i in [(x-1)..(x+1)] do | |
for j in [(y-1)..(y+1)] do | |
if ((i <> x || j <> y) && | |
Utility.InArrayRange i j states.Length) | |
then yield states.[i].[j];] | |
|> Utility.FoldBySum |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static member Step(states : int [][]) : int[][] = | |
[| for x in 0..states.Length - 1 do | |
yield [| for y in 0..states.[0].Length - 1 do | |
match Game.NeighborsAt(x,y,states) with | |
| 3 -> yield 1 | |
| 2 -> yield states.[x].[y] | |
| _ -> yield 0 | |
|] | |
|] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require("http"); | |
var OPENWEATHER_APP_ID = '<your-openweather-api-key>'; | |
var stringify_temperature = function (weather, city) { | |
return 'The current temperature at ' | |
+ city | |
+ ' is ' | |
+ (parseFloat(JSON.parse(weather).main.temp) - 273) | |
.toFixed(2) | |
.toString(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Movie = { Id : BsonObjectId; Title : string; Score : float } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#r "<path_to_proj>\packages\MongoDB.Driver.<version>/lib/net45/MongoDB.Driver.dll" | |
#r "<path_to_proj>\packages\MongoDB.Driver.Core.<version>/lib/net45/MongoDB.Driver.Core.dll" | |
#r "<path_to_proj>\packages\MongoDB.Bson.<version>/lib/net45/MongoDB.Bson.dll" | |
open MongoDB.Bson | |
open MongoDB.Driver |
OlderNewer