This file contains hidden or 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
#!/usr/bin/env bash | |
set -e | |
curl -s -H "Circle-Token: $CIRCLE_API_TOKEN" "https://circleci.com/api/v1.1/project/github/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/$CIRCLE_BUILD_NUM/artifacts" > tmp/.artifacts.json | |
COV_URL=`cat tmp/.artifacts.json | jq -r 'map(select(.["path"] == "coverage/index.html")) | .[].url'` | |
PERCENTAGE_LINE=`cat coverage/.last_run.json | jq '.result.line'` | |
PERCENTAGE_BRANCH=`cat coverage/.last_run.json | jq '.result.branch'` | |
COV_DESC="$PERCENTAGE_LINE% covered (branch: $PERCENTAGE_BRANCH%)" |
This file contains hidden or 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
FactoryBot.define do | |
# @example Build :user as | |
# class Foo::User < ActiveType::Record[User]; end | |
# | |
# FactoryBot.build(:user, :typed, as: Foo::User) | |
trait :typed do | |
transient do | |
as { nil } | |
end |
This file contains hidden or 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
module FFaker | |
# :nocov: | |
module LoremJA | |
require 'ya_lorem_ja' | |
extend ::FFaker::ModuleUtils | |
module_function | |
Lorem = YaLoremJa::Lorem.new |
This file contains hidden or 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 AasmvizController < ApplicationController | |
before_action :authenticate_account! | |
before_action :require_admin! | |
def index | |
Rails.application.eager_load! | |
@models = ActiveRecord::Base.descendants.select { |c| c.respond_to? :aasm } | |
end | |
def show |
This file contains hidden or 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
module Devise | |
module Encryptable | |
module Encryptors | |
class MessageEncryptor < Base | |
class << self | |
def digest(password, stretches, salt, papper) | |
encryptor = ::ActiveSupport::MessageEncryptor.new(papper) | |
encryptor.encrypt_and_sign(password) | |
end | |
alias :encrypt :digest |
This file contains hidden or 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
module PaperTrail | |
module Model | |
module InstanceMethods | |
private | |
def item_before_change | |
attributes.tap do |prev| | |
enums = self.respond_to?(:defined_enums) ? self.defined_enums : {} | |
changed_attributes.select { |k,v| self.class.column_names.include?(k) }.each do |attr, before| | |
before = enums[attr][before] if enums[attr] | |
if defined?(CarrierWave::Uploader::Base) && before.is_a?(CarrierWave::Uploader::Base) |
This file contains hidden or 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
try { | |
// $pdo は接続オブジェクト | |
$pdo = new PDO("mysql:host=localhost; dbname=pdotest", | |
"root", "pass"); | |
$stmt = $pdo->query("SELECT * FROM CD"); | |
while($row = $stmt->fetch(PDO::FETCH_ASSOC)){ | |
echo implode(", ", $row) . PHP_EOL; | |
} | |
} catch (PDOException $e){ |
This file contains hidden or 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 bro3_auto_phantom | |
// @version 0.1 | |
// @description enter something useful | |
// @match http://m17.3gokushi.jp/card/event_battle_top.php?scope=4* | |
// @match http://m17.3gokushi.jp/card/event_battle_result.php* | |
// @match http://m17.3gokushi.jp/card/event_battle_attack.php* | |
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js | |
// @copyright 2012+, You | |
// ==/UserScript== |
This file contains hidden or 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 bro3_trade_util | |
// @namespace 3gokushi | |
// @description ブラ三トレード支援ツール | |
// @include http://m*.3gokushi.jp/card/deck.php* | |
// ==/UserScript== | |
var d = document; | |
var $ = function(id) { return d.getElementById(id); }; | |
var $x = function(xp,dc) { return d.evaluate(xp, dc||d, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; }; |
This file contains hidden or 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 3gokushi-Beyond | |
// @namespace 3gokushi-hatt | |
// @description ブラウザ三国志用便利機能色々ごった煮 by hatt+ろむ+α | |
// @include http://*.3gokushi.jp/* | |
// @author hatt,romer,etc... | |
// @version 1.27.2.6 | |
// ==/UserScript== | |
// | |
// FireFox / Google Chrome対応です。 |
NewerOlder