This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package mymock.test; | |
import junit.framework.TestCase; | |
import mockit.Mocked; | |
import mockit.NonStrictExpectations; | |
import java.util.Map; | |
public class SystemTest extends TestCase { | |
private Map<String, String> envs = null; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- encoding: UTF-8 -*- | |
gem 'capybara', '>= 1.1.2' | |
gem 'selenium-webdriver' ,'>= 2.20.0' | |
require 'capybara' | |
require 'capybara/dsl' | |
require "selenium-webdriver" | |
include Capybara::DSL | |
# ENV['HTTP_PROXY'] = ENV['http_proxy'] = nil # proxyを使わない場合 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getCsvLastLineFirstColumnValue(text) { | |
var lines = text.split("\n"); | |
var i = 0; | |
for (i = 0; i < lines.length; i++) { | |
var items = lines[lines.length - 1 -i].split(","); | |
var val = parseInt(items[0].replace("\"", "")); | |
if (isFinite(val)) { // <= NG: val != Number.NaN | |
return val; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function(){window.alert(document.title)})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
gem 'aws-sdk' | |
require 'aws' | |
require 'optparse' | |
access_key_id = nil | |
secret_access_key = nil | |
endpoint = 's3-ap-northeast-1.amazonaws.com' | |
bucket = nil | |
object_key = nil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env ruby | |
RAILS_BASE = "/my/rails/dir/" | |
require RAILS_BASE + 'config/environment' | |
dbconfig = YAML.load_file(RAILS_BASE + 'config/database.yml')['production'] | |
ActiveRecord::Base.establish_connection(dbconfig) | |
p User.all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A sample Gemfile | |
source "https://rubygems.org" | |
gem 'aws-sdk' | |
gem 'mime-types' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'uri' | |
require 'json' | |
require 'net/http' | |
role = Net::HTTP.get(URI.parse("http://169.254.169.254/latest/meta-data/iam/security-credentials/")) | |
ret = Net::HTTP.get(URI.parse("http://169.254.169.254/latest/meta-data/iam/security-credentials/#{role}")) | |
dat = JSON.parse(ret) | |
puts dat["AccessKeyId"] | |
puts dat["SecretAccessKey"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package { | |
import flash.display.*; | |
import flash.text.*; | |
public class HelloWorld extends Sprite { | |
public function HelloWorld () { | |
var textField:TextField = new TextField(); | |
textField.text = "Hello World"; | |
addChild(textField); | |
} |
OlderNewer