Skip to content

Instantly share code, notes, and snippets.

Takuro Monji monzou

Block or report user

Report or block monzou

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
@monzou
monzou / index.ts
Last active Aug 9, 2018
Next.js + TypeScript
View index.ts
import { Context } from 'next'
import Head from 'next/head'
import * as React from 'react'
import { compose, lifecycle, pure, wrapDisplayName } from 'recompose'
function withInitialProps<Props>(provider: (context: Context) => object) {
return (BaseComponent: React.ComponentType<Props>) => {
return class extends React.Component<Props> {
public static displayName = wrapDisplayName(BaseComponent, 'withInitialProps')
public static async getInitialProps(context: Context) {
@monzou
monzou / alfred.applescript
Last active Jan 29, 2019
Bear note templates
View alfred.applescript
on alfred_script(q)
tell application "Terminal"
activate
do script q
delay 0.5
quit
end tell
end alfred_script
View ClassCollector.kt
object ClassCollector {
private val KINDS = setOf(JavaFileObject.Kind.CLASS)
private val fileManager: JavaFileManager
init {
val compiler = ToolProvider.getSystemJavaCompiler()
fileManager = compiler.getStandardFileManager(DiagnosticCollector<JavaFileObject>(), null, null)
}
@monzou
monzou / LockManager.java
Last active Jun 13, 2019
RedisLockManager
View LockManager.java
package sandbox;
import java.time.Duration;
import java.util.Optional;
import java.util.concurrent.TimeoutException;
/**
* グローバルなロックを司るコンポーネントです。
*/
public interface LockManager {
@monzou
monzou / path.js
Created Nov 5, 2016
Fetch API wrapper
View path.js
const existy = value => value !== null && value !== undefined
export function resolve (host, relative, params) {
const path = `${host}/${relative}`
if (params) {
return `${path}?${toQueryParams(params)}`
}
return path
}
@monzou
monzou / line-symbol.js
Created Oct 21, 2015
d3.js line-symbol
View line-symbol.js
const LINE_SYMBOL_FACTORY = (size) => {
let [ w, h ] = [ size / 2, size / 8 ];
return `M ${-w},${-h} L ${w},${-h} ${w},${h} ${-w},${h} Z`;
}
@monzou
monzou / tooltip.js
Last active Jun 26, 2018
GuidelineLayer + Tooltip w/ Plottable.js
View tooltip.js
import d3 from 'd3/d3'
import Plottable from './plottable'
const findDOMNode = (node, tag) => {
tag = tag.toUpperCase()
while (node.parentNode) {
node = node.parentNode
if (node.tagName.toUpperCase().trim() === tag) {
return node
}
@monzou
monzou / Bootstrap.java
Created Dec 30, 2014
Embedded Tomcat 7
View Bootstrap.java
package bootstrap;
public final class Bootstrap {
public static void main(String[] args) {
new TomcatServer("../project/module").boot(8080);
}
private Bootstrap() {}
@monzou
monzou / user.coffee
Last active Jan 3, 2016
Backbone.ViewModel
View user.coffee
class UserViewModel extends Backbone.ViewModel
computed:
fullName:
observe: [ "firstName", "lastName" ]
value: -> (_.filter [ @get("firstName"), @get("lastName") ], (name) -> not _.str.isBlank name).join (" ")
@monzou
monzou / application.coffee
Last active Dec 27, 2015
asyncInitialization with Backbone.Marionette
View application.coffee
class Application extends Marionette.Application
constructor: (options) ->
super options
@_asyncInitCallbacks = []
addAsyncInitializer: (initializer) ->
@_asyncInitCallbacks.push initializer
start: (options) ->
You can’t perform that action at this time.