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
// ==UserScript== | |
// @name eplusの非当選隠し | |
// @version 0.1 | |
// @author @chiastolite | |
// @match https://north2.eplus.jp/sys/main.jsp* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
document.querySelectorAll("#contents > div.appli-situation > table > tbody:nth-child(2) > tr[class='win-failure']").forEach( function(element) { element.style.display ="none"; }); |
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
class Coupon < ApplicationRecord | |
scope :expired, -> { where('valid_until < ', Time.zone.now) } | |
def expired? | |
valid_until < Time.zone.now | |
end | |
end |
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/bash | |
if [ $# -ne 1 ]; then | |
echo 'Usage: git new repository_name' | |
exit 1 | |
fi | |
REPO_NAME=$1 | |
REPO_DIR=$(ghq root)/github.com/$(whoami)/$REPO_NAME |
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
# ログからクエリ発行が多いとこを特定するために呼出元を回数順に並べるやつ | |
# 途中のsedは色付け用のエスケープシーケンスを消すやつ | |
grep 'ActiveRecord::Cause' log/development.log| sed $'s,\x1b\\[[0-9;]*[a-zA-Z],,g' | sort |uniq -c | sort -n |
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/bash | |
# Gitリポジトリ内ではなければ処理をしない | |
git status > /dev/null 2>&1 | |
if [ $? != 0 ] ; then | |
echo "Not a git repository" | |
exit 1 | |
fi | |
# stagingされているファイルがある場合は処理をしない | |
if [ -n "`git diff --name-only --cached`" ]; then |
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
FooModel.pluck(:hoge_id, :id) | |
# => [[1, 1], [1, 2], [2, 3], [3, 4], [3, 5]] | |
# ↑これを↓こんな風にhoge_id毎にまとめたい | |
# => {1 => [1, 2], 2 => [3], 3 => [4, 5]} |
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
class Entry < ActiveRecord:Base | |
has_many :messages | |
has_one :latest_message, -> { merge(Message.latest) }, class_name: 'Message' | |
end | |
class Message < ActiveRecord:Base | |
scope :latest, -> { order(id: :desc) } | |
end |
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
[103m [103m [101m [101m [101m [101m [103m [103m [103m [103m [101m [103m [103m [103m [103m [103m [103m [103m [103m [103m [103m [101m [101m [101m [101m [101m [41m [41m [41m [41m [41m [41m [41m [41m [41m [41m [41m [41m [41m [0m | |
[103m [103m [101m [101m [101m [101m [103m [103m [103m [103m [101m [103m [103m [103m [101m [101m [101m [101m [103m [103m [103m [103m [103m [103m [101m [101m [101m [101m [41m [41m [41m [41m [41m [41m [41m [41m [41m [41m [41m [0m | |
[103m [103m [101m [101m [101m [101m [103m [103m [103m [103m [101m [103m [101m [100m [100m [100m [100m [100m [100m [101m [101m [103m [103m [103m [103m [103m [103m [101m [101m [101m [101m [41m [41m [41m [41m [41m [41m [41m [41m [0m | |
[103m [103m [101m [101m [101m [101m [103m [103m [103m [103m [103m [100m [100m |
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
lib = File.expand_path('../lib', __FILE__) | |
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) | |
Gem::Specification.new do |spec| | |
spec.name = "ruboty-fluent-logger" | |
spec.version = "1.0.0" | |
spec.authors = ["chiastolite"] | |
spec.email = ["[email protected]"] | |
spec.summary = "foward all messages to fluentd" | |
spec.license = "MIT" |
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 'bundler/setup' | |
Bundler.require | |
require 'google/api_client' | |
require 'google/api_client/client_secrets' | |
require 'google/api_client/auth/installed_app' | |
client = Google::APIClient.new( | |
:application_name => 'Example Ruby application', | |
:application_version => '1.0.0' | |
) |
NewerOlder