Skip to content

Instantly share code, notes, and snippets.

View masahitojp's full-sized avatar
🎯
Focusing

Masato Nakamura masahitojp

🎯
Focusing
View GitHub Profile
@masahitojp
masahitojp / withMixpanel
Created June 12, 2019 00:34
it's a example for RenderProps to HoC for react-mixpanel v1.0
// @flow
import { MixpanelConsumer } from 'react-mixpanel'
import { fromRenderProps } from 'recompose'
const enhancer = fromRenderProps(MixpanelConsumer, (mixpanel) => ({
mixpanel,
}))
export default enhancer
// Template Tree
global.templateIDsByPath = global.templateIDsByPath || {
'404': undefined
}
// Get template for given path
const getComponentForPath = path => {
path = cleanPath(path)
return global.componentsByTemplateID[global.templateIDsByPath[path]]
}
PatternsSpec.scala
PoolSpec.scala
PipelineSpec.scala
@masahitojp
masahitojp / gist:ea91b3054c2574a89d9b486dc37c437c
Created June 13, 2018 10:19
OCaml: int_string to int List
# #load "str.cma";;
# List.map int_of_string (Str.split (Str.regexp "[^0-9]+") "1234");;
- : int list = [1234]
# List.map int_of_string (Str.split (Str.regexp "") "1234");;
- : int list = [1; 2; 3; 4]
import akka.actor.IO._
import akka.actor.{Props, IO, IOManager, Actor, ActorSystem}
import akka.event.Logging
import akka.util.ByteString
import java.net.InetSocketAddress
class TCPEchoServer(port: Int) extends Actor {
val log = Logging(context.system, this)
val state = IterateeRef.Map.async[IO.Handle]()(context.dispatcher)

Fabric2系のメモ

object detail
chage date 2018/5/12
version fabic 2.0.0
os ubuntu 18.04
python 3.6.5
swagger: '2.0'
info:
version: v2
title: YourName. API
host: yourname.nulab-inc.com
basePath: /api/v2
schemes:
- https
produces:
- application/json
package me.masahito;
import java.io.*;
import java.nio.channels.FileChannel;
public class FileCopyMain {
private static void copyFileUsingStream(File source, File dest) throws IOException {
try(
@masahitojp
masahitojp / HelloWorld.scala
Last active November 4, 2017 03:42
minimum scala compile settings for gradle-scala
object HelloWorld {
def main(args: Array[String]): Unit = {
println("Hello, world!")
}
}
>>> from datetime import datetime
>>> from unittest import mock
>>> with mock.patch('__main__.datetime') as m:
... datetime.now() > datetime.now()
...
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
TypeError: '>' not supported between instances of 'MagicMock' and 'MagicMock'