Skip to content

Instantly share code, notes, and snippets.

@indare
indare / Enum.php
Last active February 23, 2016 03:55
enumっぽいやつ。
<?php
namespace src;
use InvalidArgumentException;
use ReflectionObject;
abstract class Enum
{
private $scalar;
@indare
indare / .gitconfig
Last active August 29, 2015 14:24
gitignoreとか
# This is Git's per-user configuration file.
[core]
# Please adapt and uncomment the following lines:
user = 'fugafuga'
email = hoge@fuga.com
excludesfile = /Users/fugafuga/.gitignore
autocrlf = input
editor = "/Applications/Emacs.app/Contents/MacOS/Emacs"
[user]
name = Fugafuga Hogeo
@indare
indare / env.rb
Last active August 29, 2015 14:13
Capybara + PhantomJS + WebDriver
Capybara.app = 'https://at2.admin.fortunemusic.jp'
Capybara.app_host = 'https://at2.admin.fortunemusic.jp'
Capybara.run_server = false
Capybara.register_driver :poltergeist do |app|
options = {
debug: false,
js_errors: false,
inspector: true,
timeout: 20,
@indare
indare / Fuga.groovy
Created August 3, 2012 07:49
ClassNotFountになったぞ・・・('A`)
package info.indare.hogehoge.fuga
import info.indare.hogehoge.Pugya
class Fuga extends Pugya{
def moto(){
println this.getClass().getName()
}
}
@indare
indare / ajaxTest.js
Created July 3, 2012 12:17
表示html
function getJsonData(){
$.ajax({
url: "http://localhost/php/gist/temp.php", // リクエストURL
dataType: "json", // JSON形式
cache: true, // キャッシュする
type: "POST", // POST指定
success: function(data) { // 通信成功時の無名関数
$("#targetElement").children().remove();
$("#targetElement").
@indare
indare / VendingSpec.groovy
Created June 24, 2012 08:37 — forked from kyonmm/VendingSpec.groovy
Cafe.Spockでの演習
import spock.lang.Specification
import spock.lang.Unroll
/**
* Created by IntelliJ IDEA.
* User: kyon
* Date: 12/06/24
* Time: 14:53
* To change this template use File | Settings | File Templates.
*/
class VendingSpec extends Specification {
@indare
indare / phpUnitRunner.groovy
Created June 14, 2012 04:12
phpUnitRunner
def phpUnitPath = '/opt/local/bin/'
def targetTestClass = '/workspace/cron/test/TestCheckMembers.php'
def cmd = phpUnitPath + 'phpunit ' + targetTestClass
def p = Runtime.getRuntime().exec(cmd)
def r = p.getInputStream().newReader('UTF-8')
r.eachLine{
if((~/OK \(/).matcher(it).find()){
Runtime.getRuntime().exec('/usr/local/bin/growlnotify -t phpUnit -m Green --image /Green.png')
}
@indare
indare / nagoya.groovy
Created May 18, 2012 02:29
nagoya.groovy
/**
* Created with IntelliJ IDEA.
* User: m_arino
* Date: 12/05/18
* Time: 11:10
* To change this template use File | Settings | File Templates.
*/
(0..100).toArray().each {
@indare
indare / gist:2699484
Created May 15, 2012 06:06
Closure<php>
<?php
function newCounter(){
$i = 0;
return function() use ($i){
return ++$i;
};
}
//$c = newCounter();
<?php
require_once 'PHPUnit/Autoload.php';
class testBoolCheck extends PHPUnit_Framework_TestCase {
public function testBoolCheck_1(){
$this->assertEquals(is_bool(-1),false);
}
public function testBoolCheck_2(){