Skip to content

Instantly share code, notes, and snippets.

View e2kaneko's full-sized avatar

e2info金子 e2kaneko

View GitHub Profile
@e2kaneko
e2kaneko / gist:3886588
Created October 13, 2012 23:27
CSS3のサンプル
@import url(http://fonts.googleapis.com/css?family=Russo+One);
#wrapper {
background: hsla(30, 20%, 95%, .25)
-webkit-linear-gradient(45deg, hsla(0, 0%, 0%, 0) 0px,
hsla(0, 0%, 0%, 0) 1px, hsla(0, 0%, 0%, .1) 2px, hsla(0, 0%, 0%, .1)
3px );
text-align: center;
display: -webkit-box;
display: -moz-box;
@e2kaneko
e2kaneko / mop.groovy
Created October 8, 2012 12:48
GroovyのMOP(Meta Object Protocol)
package com.e2info.groovy
// groovy.lang.GroovyObject#getMetaClass
String.metaClass.define {
hello { return "hello " + delegate }
bye { return "bye " + delegate }
}
println "world".hello()
@e2kaneko
e2kaneko / gist:3846765
Created October 7, 2012 01:29
いまのpom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.e2info</groupId>
<artifactId>SpringMVCSample</artifactId>
<packaging>war</packaging>
<version>1.0</version>
<organization>
<name>e2info</name>
@e2kaneko
e2kaneko / imagecolorcode.php
Created October 1, 2012 09:09
PHP - 画像からカラーコード取得
<?php
require_once "lib/ImageFileProperty.php";
$imageUrl = "http://example.com/file_path_here.jpg";
$ex = new ImageFileProperty();
$ex->image = $imageUrl;
$colors = $ex->getColor();
@e2kaneko
e2kaneko / gist:3806009
Created September 30, 2012 06:03
GroovyのMixin(ミックスイン)
package com.e2info.groovy
class Hello {
static hello(String arg) {
println "hello $arg."
}
}
class Bye {
static bye(String arg){
@e2kaneko
e2kaneko / gist:3803171
Created September 29, 2012 04:33
GroovyのClosure(クロージャ)コレクションの繰り返し
package com.e2info.groovy
[1, 2, 3, 4].each({x -> println x})
/*
1
2
3
4
*/
@e2kaneko
e2kaneko / gist:3803073
Created September 29, 2012 03:35
GroovyのClosure(クロージャ)スコープ(静的スコープ/レキシカルスコープ)
package com.e2info.groovy
if(true){
def a = 123
b = {print a}
}
if(true){
def a = 456
b.call();
@e2kaneko
e2kaneko / gist:3803048
Created September 29, 2012 03:16
GroovyのClosure(クロージャ)スコープ(ローカル変数の束縛)別の書き方
package com.e2info.groovy
a = "xxx"
def c = {
def a = "x_x"
return { println a }
}()
a = "xxx"
@e2kaneko
e2kaneko / gist:3781146
Created September 25, 2012 10:53
SpringFramework TestCase(Sample)
package com.e2info.developer.springmvcsample.controller;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.ui.ModelMap;
@e2kaneko
e2kaneko / gist:3774852
Created September 24, 2012 07:57
GroovyのClosure(クロージャ)スコープ(ローカル変数の束縛)
package com.e2info.groovy
a = "xxx"
def method(){
def a = "x_x"
return { println a }
}
a = "xxx"