Skip to content

Instantly share code, notes, and snippets.

View akimboyko's full-sized avatar
🙃

Akim Boyko akimboyko

🙃
View GitHub Profile
@akimboyko
akimboyko / Nat.fs
Created October 17, 2013 05:47
Quiz from Functional Programming Principles in Scala by Martin Odersky, lecture 4.2 implemented on F# with unittests
//Provide an implementation of the abstract class Nat that represents non-negative integers
//
//Do not use standard numerical classes in this implementation.
//Rather, implement a sub-object and sub-class:
//
//class Zero : Nat
//class Succ(n: Nat) : Nat
//
//One of the number zero, then other for strictly positive numbers.
namespace Nat
@controlflow
controlflow / gist:8072635
Last active January 1, 2016 01:28
Primary ctors
class ReverseForLookupItem : ForLookupItemBase
{
public ReverseForLookupItem([NotNull] PrefixExpressionContext context,
[NotNull] LiveTemplatesManager templatesManager,
[CanBeNull] string lengthPropertyName)
: base("forR", context, templatesManager, lengthPropertyName) { }
protected override IForStatement CreateStatement(CSharpElementFactory factory, ICSharpExpression expression)
{
...
# You should have pswatch installed (http://psget.net/directory/pswatch/)
# You need small modification to the FSharpKoans/PathToEnlightenment.fs to make sure that you will not need to press any key
# Comment out
# printf "Press any key to continue..."
# System.Console.ReadKey() |> ignore
# 1. Open separate powershell window
# 2. Make sure you are in FSharpKoans solution folder
# 3. Run watch_fsharpkoans.ps1
# 4. Make both your visual studio and powershell window visitble at the same time
# 5. Enjoy!
процедура MergeSort (мод a: t) це
процедура Merge(арг a: t; Size: нат; рез b: t) це
змін i, j, k, r1, r2: нат;
поч
k <- 1;
поки k<=n повт
{визначення границь підмасивів}
i <- k; r1 <- i+Size-1;
якщо r1>n то r1 <- n кр;
j <- r1+1; r2 <- j+Size-1;
@alexbeletsky
alexbeletsky / Feedback.js
Created December 18, 2012 19:07
Backbone.View done with TDD
var Feedback = Backbone.Model.extend({
url: '/feedback',
validate: function (attrs) {
var errors = [];
if (!attrs.email || attrs.email === '') {
errors.push({name: 'email', message: 'Please fill email field.'});
}
@vansha
vansha / DapperQueryHierarchy.cs
Created February 24, 2013 21:25
Querying complex object hierarchies with dapper.
public class Order {
public int Id { get; set; }
public DateTime OrderedAt { get; set }
public IList<OrderLine> OrderLines { get; set }
public Person Customer { get; set }
}
public class OrderLine {
public int Id { get; set; }
public int Count { get; set; }
@jkbradley
jkbradley / LDA_SparkDocs
Created March 24, 2015 23:56
LDA Example: Modeling topics in the Spark documentation
/*
This example uses Scala. Please see the MLlib documentation for a Java example.
Try running this code in the Spark shell. It may produce different topics each time (since LDA includes some randomization), but it should give topics similar to those listed above.
This example is paired with a blog post on LDA in Spark: http://databricks.com/blog
Spark: http://spark.apache.org/
*/
import scala.collection.mutable
@tam17aki
tam17aki / SRUCell.py
Last active April 2, 2021 17:52
A TensorFlow implementation of Simple Recurrent Unit (SRU).
# -*- coding: utf-8 -*-
# Copyright (C) 2017 by Akira TAMAMORI
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
@mausch
mausch / gist:8227399
Created January 2, 2014 21:37
Erik Meijer quotes in Reactive Programming Coursera. I did not gather them, I merely copied this from https://class.coursera.org/reactive-001/forum/thread?thread_id=1356 to make them public.
"Hopefully the third answer is right; but who knows, maybe I made a mistake; I’m just a human, I can throw exceptions as well."
"I am waving my hands on purpose here, this is very spaghetti like code. And spaghetti is great as food, but not good as code."
"flatMap will allow us to focus on the happy path. flatMap will take care of all the noise. flatMap is the dolby for programmers."
"Great programmers write baby code"
"it's obviously correct"