Skip to content

Instantly share code, notes, and snippets.

public class NewUserViewModel : ReactiveObject
{
// This is ReactiveUI's version of implementing INotifyPropertyChanged
string _Password;
public string Password {
get { return _Password; }
set { this.RaiseAndSetIfChanged(x => x.Password, value); }
}
string _PasswordConfirmation;
//My take on: http://solog.co/47/10-scala-one-liners-to-impress-your-friends/
//1. Multiple Each Item in a List by 2
//(1 to 10) map { _ * 2 }
(1 to 10) map (2*)
//2. Sum a List of Numbers
//(1 to 1000).reduceLeft( _ + _ )
(1 to 1000).sum
// C#
List<string> keywords = ...;
var result = keywords
.GroupBy(k => k[0].ToUpper())
.ToDictionary(
g => g.Key,
g => g.OrderBy(k => k).ToList());
@stonegao
stonegao / AkkaKafkaMailboxTest.scala
Created May 1, 2012 07:24 — forked from mardambey/AkkaKafkaMailboxTest.scala
Akka 2.0 actors with Kafka backed durable mailboxes.
import akka.actor.Actor
import akka.actor.ActorSystem
import akka.agent.Agent
import com.typesafe.config.ConfigFactory
import akka.event.Logging
import akka.actor.Props
import kafka.utils.Utils
import java.nio.ByteBuffer
@SethTisue
SethTisue / gist:2942990
Created June 17, 2012 00:34
add zipWith to Iterable
// add zipWith to Iterable; thank you stackoverflow.com/q/3895813
implicit class RichIterable[A, CC[X] <: Iterable[X]](xs: CC[A]) {
type Builder[C] = collection.generic.CanBuildFrom[Nothing, C, CC[C]]
def zipWith[B, C](ys: Iterable[B])(f: (A, B) => C)(implicit cbf: Builder[C]): CC[C] =
xs.zip(ys).map(f.tupled)(collection.breakOut)
}
@jcranky
jcranky / akka.xml
Last active October 7, 2015 10:28
mvn assembly for akka micro kernel
<?xml version="1.0" encoding="UTF-8"?>
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>akka</id>
<formats>
<format>zip</format>
</formats>
<fileSets>
@danieltreacy
danieltreacy / jvm-companies.md
Created September 26, 2012 02:40
Tech companies/startups migrated to the JVM

Tech companies who have migrated to the JVM

NB: Does not include companies that started with a JVM language. The purpose of this gist is to list the companies that decided to move their stack (or some part of it) to the JVM.

@viktorklang
viktorklang / InterruptibleCancellableFuture.scala
Last active June 1, 2020 13:45
Interruptible-Cancellable-scala.concurrent.Future
/*
Copyright 2018 Viktor Klang
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@viktorklang
viktorklang / git.plugin.zsh
Created May 10, 2013 16:09
A couple of nice additions to ZSH git plugin
*** /Users/viktorklang/.oh-my-zsh/plugins/git/git.plugin.zsh.old Fri May 10 18:07:33 2013
--- /Users/viktorklang/.oh-my-zsh/plugins/git/git.plugin.zsh Fri May 10 18:05:49 2013
*************** alias gcount='git shortlog -sn'
*** 14,19 ****
--- 14,21 ----
alias gcp='git cherry-pick'
alias glg='git log --stat --max-count=5'
+ alias grm='git branch -D'
+
@evgenius
evgenius / onchange.sh
Last active December 15, 2018 22:17 — forked from senko/onchange.sh
#!/bin/bash
#
# Watch current directory (recursively) for file changes, and execute
# a command when a file or directory is created, modified or deleted.
#
# Written by: Senko Rasic <senko.rasic@dobarkod.hr>
#
# Requires Linux, bash and inotifywait (from inotify-tools package).
#
# To avoid executing the command multiple times when a sequence of