Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Masato Nakamura masahitojp

🎯
Focusing
Block or report user

Report or block masahitojp

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View test.md
marp
true

footer: Python と型ヒントとその使い方 - PyCon Kyushu in Okinawa 2019 May 18th slidenumbers: true

Python と型ヒント

とその使い方

@masahitojp
masahitojp / stack.py
Created Jul 12, 2019
check generics for mypy
View stack.py
from typing import TypeVar, Generic
T = TypeVar('T', bound='Shape')
class Stack(Generic[T]):
def __init__(self) -> None:
# Create an empty list with items of type a T
print(__annotations__) # {}
self.items: List[T] = []
@masahitojp
masahitojp / withMixpanel
Created Jun 12, 2019
it's a example for RenderProps to HoC for react-mixpanel v1.0
View withMixpanel
// @flow
import { MixpanelConsumer } from 'react-mixpanel'
import { fromRenderProps } from 'recompose'
const enhancer = fromRenderProps(MixpanelConsumer, (mixpanel) => ({
mixpanel,
}))
export default enhancer
View index.js
// 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]]
}
View gist:1e3eb2d0c927ef727a640c3d5c30ccde
PatternsSpec.scala
PoolSpec.scala
PipelineSpec.scala
View gist:ea91b3054c2574a89d9b486dc37c437c
# #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]
View fabric2.md

Fabric2系のメモ

object detail
chage date 2018/5/12
version fabic 2.0.0
os ubuntu 18.04
python 3.6.5
View swagger.yaml
swagger: '2.0'
info:
version: v2
title: YourName. API
host: yourname.nulab-inc.com
basePath: /api/v2
schemes:
- https
produces:
- application/json
@masahitojp
masahitojp / HelloWorld.scala
Last active Nov 4, 2017
minimum scala compile settings for gradle-scala
View HelloWorld.scala
object HelloWorld {
def main(args: Array[String]): Unit = {
println("Hello, world!")
}
}
View gist:ff84c37b7ae1b9430005e536d60f43cc
>>> 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'
You can’t perform that action at this time.