Skip to content

Instantly share code, notes, and snippets.

@sue445
sue445 / td-agent.conf
Last active August 29, 2015 14:03
Example of fluentd + gitlab webhook + Chatwork notification http://sue445.hatenablog.com/entry/2014/06/29/094035
<source>
type http
port 8888
</source>
<match gitlab.**>
type copy
<store>
type rewrite
add_prefix filtered
@sue445
sue445 / MapBenchmarkTest.java
Created August 5, 2014 14:43
HashMapとLinkedHashMapのベンチマーク
/**
* HashMapとLinkedHashMapの性能を調べるためのベンチマーク用のテストコード
*
* テスト内容
* ・乱数を100万回putして実行時間を出力
* ・乱数keyで100万回getして実行時間を出力
* ・mapのサイズを取得して実行時間を出力
*
* インスタンスのメモリサイズの取得にはClassmexerを使用しているため実行時に下記オプションをつけること
* -javaagent:./lib/classmexer.jar
@sue445
sue445 / plus1.md
Created September 18, 2014 09:07
👍
:+1:

👍

@sue445
sue445 / hello_world.groovy
Created October 22, 2014 09:13
hello world
println "hello world"
@sue445
sue445 / created_at_range_partition_module.rb
Last active August 29, 2015 14:10
date partitioning module for rails4
# created_atでRANGEパーティショニングされたmodelの共通module
#
# @example
# class CreatedAtRangePartitionModel < ActiveRecord::Base
# include ActsAsMysqlPartition::CreatedAtRangePartitionModule
#
# end
module CreatedAtRangePartitionModule
extend ActiveSupport::Concern
@sue445
sue445 / .paraduct.yml
Created December 1, 2014 16:15
matrix test script file for paraduct (https://github.com/sue445/paraduct)
script: |-
./script/build_for_jenkins.sh
work_dir: tmp/paraduct_workspace
variables:
gemfile:
- rails4_0.gemfile
- rails4_1.gemfile
max_threads: 4
rsync_option:
exclude_from: .paraduct_rsync_exclude.txt
@sue445
sue445 / precure_color.rb
Created February 2, 2015 11:05
rubicureでプリキュアの色の多い順に調べるワンライナー(ゴプリキュア対応版)
require "rubicure"
Precure.all_stars.group_by{ |girl| girl.color }.map{ |color, girls| [color, girls.count] }.sort_by{ |color, girl_count| girl_count }.reverse
# => [["pink", 9], ["yellow", 8], ["blue", 7], ["purple", 4], ["red", 4], ["white", 3], ["green", 2], ["black", 1]]
@sue445
sue445 / sleep.rb
Last active August 29, 2015 14:15
sleepで指定した秒数だけsleepされるわけではない
irb(main):001:0> ret = sleep 0.1
#=> 0
irb(main):002:0> ret = sleep 1.5
#=> 2
@sue445
sue445 / precure.yml
Created March 6, 2015 08:52
Rails 4.2のconfig_forで遊んでみた
# config/precure.yml
common: &common
smile_precure:
cure_happy: 星空みゆき
cure_sunny: 日野あかね
cure_peace: 黄瀬やよい
cure_march: 緑川なお
cure_beauty: 青木れいか
development:
@sue445
sue445 / chrome-web-inspector.js
Last active August 29, 2015 14:20
instagramからLike数の多いのを抽出するスクリプト
// Chromeのwebインスペクタに下記を入力して実行
var images = [];
$(".PhotoGridMediaItem").each(function(){
// ex. いいね!7件・コメント0件
var label = $(this).attr("aria-label");
var url = "https://instagram.com" + $(this).find(".pgmiImageLink").attr("href");
images.push({label: label, url: url});
});
// labelで降順ソート