Skip to content

Instantly share code, notes, and snippets.

Hidetake Iwata int128

Block or report user

Report or block int128

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 add.groovy
def x = {}
def y = {}
def a = [k: x, l: 0, m: 'a']
def b = [k: y, l: 1]
println x
println y
println a
println b
@int128
int128 / gist:10613715
Last active Aug 29, 2015
Create an immutable object by a closure instead of the hash constructor
View gist:10613715
class ImmutableFactory<T> {
private final Map<String, Object> propertiesMap = [:]
private final Class<T> clazz
def ImmutableFactory(Class<T> clazz) {
this.clazz = clazz
}
T create() {
@int128
int128 / immutable.groovy
Last active Aug 29, 2015
could not initialize immutable in immutable by map
View immutable.groovy
@groovy.transform.Immutable
class A {
int x
}
@groovy.transform.Immutable
class B {
int y
@Delegate
A a = new A([:])
@int128
int128 / plus-settings.groovy
Last active Aug 29, 2015
Enumerate properties of an object using meta class
View plus-settings.groovy
class S {
def propertiesAsMap() {
this.metaClass.properties.collectEntries { p ->
[(p.name): p.modifiers]
}
}
}
class A extends S {
static int DEFAULT
@int128
int128 / gist:11244516
Created Apr 24, 2014
Macro to trim or append trailing LF
View gist:11244516
Sub TrimTrailingLFInSelection()
Dim c As Range
For Each c In Selection
If Right(c.Text, 1) = vbLf Then
c.Value = Left(c.Text, Len(c.Text) - 1)
End If
Next
@int128
int128 / gist:1be8b651c3f42fa03858
Created May 10, 2014
@javax.inject.Inject does not work on Gradle plugin
View gist:1be8b651c3f42fa03858
org.gradle.api.tasks.TaskInstantiationException: Could not create task of type 'SshTask'.
at org.gradle.api.internal.project.taskfactory.TaskFactory$1.call(TaskFactory.java:126)
at org.gradle.api.internal.project.taskfactory.TaskFactory$1.call(TaskFactory.java:121)
at org.gradle.api.internal.AbstractTask.injectIntoNewInstance(AbstractTask.java:148)
at org.gradle.api.internal.project.taskfactory.TaskFactory.createTaskObject(TaskFactory.java:121)
at org.gradle.api.internal.project.taskfactory.TaskFactory.createTask(TaskFactory.java:81)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory.createTask(AnnotationProcessingTaskFactory.java:99)
at org.gradle.api.internal.project.taskfactory.DependencyAutoWireTaskFactory.createTask(DependencyAutoWireTaskFactory.java:39)
at org.gradle.api.internal.tasks.DefaultTaskContainer.create(DefaultTaskContainer.java:52)
at org.gradle.api.internal.project.AbstractProject.task(AbstractProject.java:958)
@int128
int128 / gist:af097d5d5a82bc6dd4b6
Created May 22, 2014
Adding static property on runtime
View gist:af097d5d5a82bc6dd4b6
@groovy.transform.ToString
class A {
//static final int P = 100
int x
}
A.metaClass.P = 100
def a = new A()
a.with {
View zabbix-alert.md

携帯メールでは受信日時が分かりにくいので日時を付加。

title

{DATE} {TIME} ({TRIGGER.STATUS}) {TRIGGER.NAME}

message

View nfs4.md

environment

  • Gentoo Linux
  • 2.6.31-gentoo-r10 (KVM hypervisor/KVM guest)
  • net-fs/nfs-utils-1.1.4-r1

/etc/auto.misc

View fix-java-plugin.md

Fix Java plugin version of Google Chrome

Launch regedit.exe and open following key:

HKEY_LOCAL_MACHINE\SOFTWARE\MozillaPlugins\@java.com/DTPlugin,version=xxxx

Fix or create item there:

Path=C:\Program Files\Java\jdk1.7.0_07\jre\bin\plugin2\npjp2.dll

You can’t perform that action at this time.