Skip to content

Instantly share code, notes, and snippets.

View reflash's full-sized avatar
🐢
Procrastinating

Daniil reflash

🐢
Procrastinating
View GitHub Profile
public void ExampleMethod()
{
 object a = new object();
 object b = new object();
 //
 a = null;
 b = null;
}
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();
Program.listener -= new EventHandler(Some);
[<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|];
[<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
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
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
|]
|]
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();
}
type Movie = { Id : BsonObjectId; Title : string; Score : float }
#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