Skip to content

Instantly share code, notes, and snippets.

View gongo's full-sized avatar

Wataru MIYAGUNI gongo

View GitHub Profile
@gongo
gongo / main.go
Created September 25, 2013 03:53
指定したディレクトリ以下のファイルを指定したポートでブラウザから閲覧できるようにするやつの練習
package main
import (
"fmt"
"github.com/mattn/go-options"
"net/http"
"os"
"path/filepath"
)
@gongo
gongo / main.go
Created September 22, 2013 00:04
https://github.com/golang-samples/goweb/blob/master/mapfunc/main.go がそのままだと動かなかったので、とりあえず動く感じにしてみた
package main
import (
"fmt"
"github.com/stretchr/goweb"
"github.com/stretchr/goweb/context"
"net/http"
)
func main() {
@gongo
gongo / Gemfile
Last active December 22, 2015 17:59
Selenium の Stale Element Reference Exception を出してみたい
source "https://rubygems.org"
gem 'capybara'
gem 'selenium-webdriver'
gem 'sinatra'
@gongo
gongo / Gemfile
Last active February 14, 2018 22:14
Capybara の稼働状況を animation gif として保存するようなやつ
source 'https://rubygems.org'
gem 'capybara'
gem 'rake'
gem 'selenium-webdriver'
gem 'json'
gem 'rmagick'
@gongo
gongo / read-datetime.el
Last active December 17, 2015 16:09
Parse ISO8601 (Zulu) string
(defun gongo:read-datetime ()
(unless (re-search-forward "\\([0-9]\\{4\\}\\)-\\(0[1-9]\\|1[0-2]\\)-\\(0[1-9]\\|[1-2][0-9]\\|3[0-1]\\)T\\([0-1][0-9]\\|2[0-4]\\):\\([0-5][0-9]\\):\\([0-5][0-9]\\)Z" nil t)
(message "error"))
(let ((seconds (string-to-number (match-string-no-properties 6)))
(minutes (string-to-number (match-string-no-properties 5)))
(hour (string-to-number (match-string-no-properties 4)))
(day (string-to-number (match-string-no-properties 3)))
(month (string-to-number (match-string-no-properties 2)))
(year (string-to-number (match-string-no-properties 1))))
(list seconds minutes hour day month year)))
Capybara.add_selector(:select_inexact) do
label "select box (inexact finder)"
xpath { |locator| XPath::HTML.select(locator) }
filter(:options) do |node, options|
actual = node.all(:xpath, './/option').map { |option| option.text }
actual.zip(options).all? { |act, opt| Regexp.new(opt).match(act) }
end
end
module Capybara
@gongo
gongo / Gemfile
Last active December 16, 2015 14:59
Selenium Webdriver with IE8 で「onclick 内 function で submit() した場合、radio button の value が post されない」ってのを確かめるためのもの。
source "https://rubygems.org"
gem 'capybara'
gem 'sinatra'
gem 'selenium-webdriver'
#!/usr/bin/env php
<?php
class PhpCompletion
{
public static function make_completion()
{
$completion = new self;
$completion->print_version();
$completion->make_completion_constants();
Feature: アラートとコンフォーム
Scenario: hoge
Given アクセス
When alertボタンをクリック
Then あらーーーと
Scenario: fuga
Given アクセス
When confirmボタンをクリック
#!/usr/bin/env ruby
require 'table_beet'
require "turnip"
Dir.glob("steps/**/*steps.rb") { |f| load f, true }
RSpec.configuration.include_or_extend_modules.each do |ioe, mod, filters|
c = Class.new.extend(mod)
step_names = c.methods.grep(/^match: (?<step_name>.+)/) { $~[:step_name] }