Skip to content

Instantly share code, notes, and snippets.

View akimboyko's full-sized avatar
🙃

Akim Boyko akimboyko

🙃
View GitHub Profile
#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 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
// ==============================
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
@raindev
raindev / game-of-life.hs
Created November 15, 2014 18:23
Game of life produced on the last coding session of Kyiv Global Day of Coderetreat 2014
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))
class CreateTheme
{
public int Id;
public int AccountId;
public string Name;
public Optional<string> Description;
}
static void Handle(IUnitOfWork uow, CreateTheme cmd)
{
@listochkin
listochkin / callbacks-promises-generators.js
Created December 13, 2014 11:00
Async ccode with Callbacks, Promises and Generators
/* 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");
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
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 }
@glennblock
glennblock / app.csx
Created March 10, 2013 00:02
Nancy scriptcs sample
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
@mausch
mausch / CSharpIterator.cs
Last active December 15, 2015 09:49
Anonymous iterators in C# with Ix
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