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 / 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 / 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
@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 / 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 / build.gradle
Created Feb 17, 2013
Eclipse + Gradle Multi Project (flat layout)
View build.gradle
apply plugin: 'eclipse'
subprojects {
apply plugin: 'java'
apply plugin: 'eclipse-wtp'
jdkVersion = 1.7
sourceCompatibility = jdkVersion
targetCompatibility = jdkVersion
@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
}
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)
}
View SimpleCompressor.java
package sandbox;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.zip.DataFormatException;
import java.util.zip.Deflater;
import java.util.zip.Inflater;
import org.apache.commons.io.IOUtils;
@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 / 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 (" ")
You can’t perform that action at this time.