Skip to content

Instantly share code, notes, and snippets.

require 'trello'
require 'tracker_api'
require 'pry'
Trello.configure do |config|
config.developer_public_key = 'your_public_key'
config.member_token = 'your_token'
end
joe_re = Trello::Member.find('joe_re')
board = Trello::Board.find('your_board_id')
@joe-re
joe-re / gist:9fbd506f042c619d8cde
Last active September 19, 2015 16:53
Scalaはじめてみる
@joe-re
joe-re / はじぱた_section4.md
Last active September 13, 2015 17:36
はじぱた4章

実行例4.1

平均ベクトル

mean(iris$Petal.Length)
mean(iris$Petal.Width)
cbind(matrix(mean(iris$Petal.Length)), matrix(mean(iris$Petal.Width)))

共分散行列

extend hash and spread args

todos = [{
  id: 1,
  text: 'test'
}];

({...todo,text: 1});
@joe-re
joe-re / config.rb
Last active August 29, 2015 14:18
pumaに学ぶRubyのDSLの作り方
foo 'test'
block_test do
puts 'blockも渡せる'
end
# コメントは無視される
boolean_test
@joe-re
joe-re / command_memo.md
Last active August 29, 2015 14:16
忘れそうなコマンドとか設定のメモ

commands

sudoでワイルドカードとか使いたい

sudo sh -c "du -m /db/dbname/PG_9.0_201008051/16386/* | sort -nr"

dnsに解決できるホストを問い合わせたい

dig axfr somedomain.co.jp
@joe-re
joe-re / GenericsTest.java
Last active August 29, 2015 14:15
the most easy java generics sample
package jp.co.example;
import java.util.ArrayList;
import java.util.List;
public class GenericsTest {
public static void main(String[] args) {
List<String> generatedList = ListGenerator.generate("this", "is", "a", "generics", "test!");
System.out.println(generatedList);
for (String e : generatedList) {
import jsm
import datetime
class Stock:
def __init__(self, stock_code, start_date, end_date):
q = jsm.Quotes()
self.prices = q.get_historical_prices(4689, jsm.DAILY, start_date, end_date)
def calc_close_average(self, index, avg_count):
if len(self.prices) < index + avg_count:
return None
@joe-re
joe-re / shot.rb
Created January 17, 2015 06:33
selenium-webdriverを使って、4人のユーザでそれぞれログインしてスナップショットを撮る
require 'selenium-webdriver'
driver = Selenium::WebDriver.for :firefox
FileUtils.mkdir_p 'screenshots'
[
{ email: '[email protected]', password: 'yuihirasawa' },
{ email: '[email protected]', password: 'mioakiyama' },
{ email: '[email protected]', password: 'ritsutainaka' },
{ email: '[email protected]', password: 'tsumugikotobuki' },
@joe-re
joe-re / shot.rb
Last active August 29, 2015 14:13
seleniumを使ってスナップショットの取得を自動化する。その際のサーバのレスポンスはモックする
require "selenium-webdriver"
# stubbyがデーモン起動できないのでThreadで起動する。(無理やり感漂うので、いい方法あれば変えたい。)
t = Thread.new { system("forever node_modules/.bin/stubby --data #{ARGV[0]}") }
driver = Selenium::WebDriver.for :chrome, switches: %w[--allow-running-insecure-content]
# ログイン
driver.navigate.to 'https://your-awesome-app/login'
driver.find_element(:name, 'loginid').send_keys 'user_id'