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
#Example for the kaggle forums. | |
library(FNN) | |
library(stats) | |
train <- read.csv("data/train.csv", header=TRUE, comment.char="") | |
test <- read.csv("data/test.csv", header=TRUE, comment.char="") | |
N <- 30000 | |
set.seed(20140202) | |
trainingSet <- train[sample(1:nrow(train), N), ] |
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
// ============================== | |
// This gist is in response to | |
// http://programmers.stackexchange.com/questions/228939/how-to-improve-upon-blochs-builder-pattern-to-make-it-more-appropriate-for-use | |
// | |
// This is a simple bit of code to do the same thing using the Either monad (e.g. success/failure) and applicatives | |
// This code is (a) more generic (b) much shorter (c) more type safe | |
// | |
// Compare with the Java code at https://gist.github.com/swlaschin/9009343 | |
// ============================== |
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
Do you like interesting problems? Do you keep a notepad/laptop next to your bed because you tend to solve problems while sleeping? We might be a good fit. | |
We are a totally distributed team. Everyone works from home (even if home tends to be in airplanes). Most of the code we write is Open Source and is available on github http://github.com/eventstore/eventstore if you want to look through it. The team completely owns the project. | |
Perhaps we could be a good fit for you, we are seeking developers who are: | |
1) Always improving | |
2) Highly Technical | |
3) Capable of working in a remote environment | |
4) Independent |
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
import Data.List | |
-- Transform cells into next iteration | |
nextTurn :: (Integral a) => [(a,a)] -> [(a,a)] | |
nextTurn space = [(x, y) | (x,y,_) <- [head xs | xs <- cells space, length xs == 3 || (length xs == 4 && True `elem` ([x | (_,_,x) <- xs]))]] | |
-- Cells grouped by their coordinates | |
cells :: (Integral a) => [(a,a)] -> [[(a,a,Bool)]] | |
cells space = groupBy (\(x1,y1,_) (x2,y2,_) -> x1 == x2 && y1 == y2) (sort (neighbourhood space)) |
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
class CreateTheme | |
{ | |
public int Id; | |
public int AccountId; | |
public string Name; | |
public Optional<string> Description; | |
} | |
static void Handle(IUnitOfWork uow, CreateTheme cmd) | |
{ |
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
/* jshint node:true, mocha:true, eqnull:true, esnext:true */ | |
'use strict'; | |
var chai = require('chai'), | |
assert = chai.assert, | |
expect = chai.expect; | |
var request = require('request'); | |
var jsdom = require("jsdom"); |
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
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.IO; | |
using System.Linq; | |
using System.Text.RegularExpressions; | |
using FluentAssertions; | |
using NUnit.Framework; | |
using Nancy.Helpers; | |
namespace NancySelfHosting |
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
using System; | |
using System.IO; | |
using System.Web.Http; | |
using System.Web.Http.SelfHost; | |
var address = "http://localhost:8080"; | |
var conf = new HttpSelfHostConfiguration(new Uri(address)); | |
conf.Routes.MapHttpRoute(name: "DefaultApi", | |
routeTemplate: "api/{controller}/{id}", | |
defaults: new { id = RouteParameter.Optional } |
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
using System; | |
using System.Collections.Generic; | |
using Autofac; | |
using Nancy; | |
using Nancy.Bootstrapper; | |
using Nancy.Bootstrappers.Autofac; | |
using Nancy.Hosting.Self; | |
using Nancy.Routing; | |
public class Bootstrapper : AutofacNancyBootstrapper |
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 hello = ""; | |
var enumerable = | |
EnumerableEx.Create<int>(async Yield => { | |
await Yield.Return(100); | |
await Yield.Return(200); | |
hello = "hello world"; | |
await Yield.Return(300); | |
}); | |
Console.WriteLine(enumerable.ElementAt(1)); // 200 | |
Console.WriteLine(hello); // empty |
OlderNewer