Skip to content

Instantly share code, notes, and snippets.

import xs from 'xstream';
import delay from 'xstream/extra/delay';
const computerProxy = xs.create();
const humanA = computerProxy.mapTo('pin');
const humanB = humanA.map((word) => word + 'g!');
const computer = humanB.map((word) => word.replace(/ping!/, 'pong!')).startWith('Hello World').compose(delay(500));
computerProxy.imitate(computer);
computer.addListener({
import xs from 'xstream';
import delay from 'xstream/extra/delay';
import dropRepeats from 'xstream/extra/dropRepeats';
import sampleCombine from 'xstream/extra/sampleCombine';
const intentPushedCola = xs.periodic(200).compose(delay(10)).mapTo({ name: 'Cola', price: 100 });
const intentPushedRedBull = xs.periodic(100).mapTo({ name: 'RedBull', price: 200 });
const intentPushedItem = xs.merge(intentPushedCola, intentPushedRedBull).compose(dropRepeats());
const intentInsertedCoin50 = xs.periodic(1000).mapTo(50);
import xs from 'xstream';
import delay from 'xstream/extra/delay';
import dropRepeats from 'xstream/extra/dropRepeats';
import sampleCombine from 'xstream/extra/sampleCombine';
const intentColaButton = xs.periodic(800).compose(delay(10)).mapTo({ name: 'Cola', price: 100 });
const intentRedBullButton = xs.periodic(500).mapTo({ name: 'Red Bull', price: 200 });
const intentItemButton = xs.merge(intentColaButton, intentRedBullButton).compose(dropRepeats());
const intentCoin50 = xs.periodic(1000).mapTo(50);
@haru01
haru01 / rgr.js
Last active October 6, 2018 12:18
import xs from 'xstream';
import delay from 'xstream/extra/delay';
var refactorProxy = xs.create();
var red = refactorProxy.map((x) => 'Red:' + x).compose(delay(500));
var green = red.map((x) => x.replace(/Red/, 'GreenWithDebt')).compose(delay(500));
var refactor = green.map((x) => x.replace(/WithDebt/, '')).startWith('').compose(delay(500));
refactorProxy.imitate(refactor);
red.addListener({
import static java.util.Arrays.*;
import static org.junit.jupiter.api.Assertions.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.junit.jupiter.api.Test;
package poker;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static poker.PokerHandHelper.*;
public class PokerHandTest {
@DisplayName("ワンペアならスコアは1000点(仮)であること")
package poker;
import java.util.ArrayList;
import java.util.List;
import static java.util.stream.Collectors.toList;
public class Game {
List<Player> players = new ArrayList();
package poker;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static poker.PokerHandHelper.highCard;
import static poker.PokerHandHelper.onePair;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import java.util.EmptyStackException;
import java.util.Stack;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
#include "gmock/gmock.h"
#include "gtest/gtest.h"
using ::testing::NiceMock;
using ::testing::Return;
using ::testing::_; // Matcher for parameters
// 隣人
class FugaServiceClient
{