Harigami
ログイン
Harigamiは、ログイン不要のコード共有サービスです。コードの投稿後に発行されるURLでコードを共有できます。
PythonやRubyなど一部の言語は、投稿後にオンラインで実行することもできます。
誰でも無料で使えて、広告もありません。コードレビューやスニペットの代わりに使ってみてください。


詳細設定
+
anonymous タイトルなし
Python
curl -sc /tmp/cookie "https://drive.google.com/uc?export=download&id=1deN4MYiNyEEsv8WeVXpX7DsI5FkPmOdB" > /dev/null
CODE="$(awk '/_warning_/ {print $NF}' /tmp/cookie)"
curl -Lb /tmp/cookie "https://drive.google.com/uc?export=download&confirm=${CODE}&id=1deN4MYiNyEEsv8WeVXpX7DsI5FkPmOdB" -o hrnet.zip
  • 0
  • 1
anonymous タイトルなし
C#
/*投稿テスト*/

        // 時間パラメータ群とI/F
        private class TimeConfig
        {
            // タイマー割り込み発生の間隔
            public int TimerInterval;

            // 下記のTime系変数の単位はミリ秒か?秒か?
            public bool IsMilliSec;

            // Time変数群
            public int Time1Hour;
            public int Time10Min;
            public int Time1Min;
            public int Time10Sec;
            public int Time1Sec;
            public int TimeMax;

            public TimeConfig(bool msec)
            {
                InitConfig(msec);
            }

            public void InitConfig(bool msec)
            {
                IsMilliSec = msec;
                TimerInterval = msec ? 100 : 1000;
                Time1Hour = msec ? 36000 : 3600;
                Time10Min = msec ? 6000 : 600;
                Time1Min = msec ? 600 : 60;
                Time10Sec = msec ? 100 : 10;
                Time1Sec = msec ? 10 : 1;
                TimeMax = msec ? (3600000 - 1) : (360000 - 1);
            }
        }
  • 0
  • 0
anonymous タイトルなし
Python
    reqm=event['body'].split('=')[1]
    print(reqm)
    print(event['body'])
    if reqm=="今何時":
        return {
            'statusCode': 200,
            'body': json.dumps({"msg":"success"})
        }
    else:
        return {
            'statusCode': 200,
            'body': json.dumps({"msg":"error"})
        }
  • 0
  • 1
anonymous タイトルなし
C++
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)

typedef long long ll;
const int dx[2] = {1, 0};
const int dy[2] = {0, 1};

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

const int INF = 1e9;

int T[123][123] = {};
ll Cost[123][123] =  {};
int H,W,C;

bool IsIn(int x,int y){
    return 0<=x&&x<H&&0<=y&&y<W;
}
int main() {
    cin>>H>>W>>C;
    rep(i,H)rep(j,W){
        cin>>T[i][j];
        Cost[i][j] = INF;
    }
    Cost[0][0] = 0;
    queue<pair<int,int>> Q;
    Q.push({0,0});
    while(!Q.empty()){
        auto p =  Q.front();
        int x = p.first;
        int y = p.second;
        Q.pop();
        rep(i,2){
            int nx = x + dx[i];
            int ny = y + dy[i];
            if(!IsIn(nx,ny))continue;
            if(T[nx][ny]==1){
                //chmin(Cost[nx][ny], Cost[x][y] + C);
                Cost[nx][ny] = min(Cost[nx][ny], Cost[x][y] + C);
            }
            else{
                Cost[nx][ny] = min(Cost[nx][ny], Cost[x][y]);
                //chmin(Cost[nx][ny], Cost[x][y]);
            }
            Q.push({nx,ny});
        }
    }
    cout<<Cost[H-1][W-1]<<endl;
}
  • 0
  • 1
anonymous タイトルなし
Ruby
class Post < ApplicationRecord
	mount_uploader :image, ImageUploader
	validates :body, presence: true
	validates :title, presence: true
	belongs_to :user
	has_many :likes,dependent: :destroy
	has_many :liked_users, through: :likes, source: :user,dependent: :destroy
	is_impressionable counter_cache: true
	has_many :comments,dependent: :destroy
	has_many :star, dependent: :destroy

	 #ratyrate_rateable "title"
# def self.search(search)
# 	 if search
#        where(['username LIKE ?', "%#{search}%"]) #検索とuseanameの部分一致を表示。
#      else
#        all #全て表示させる
#     end
#  end

end
  • 0
  • 1
anonymous タイトルなし
Ruby
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2019_11_06_084855) do

  create_table "average_caches", force: :cascade do |t|
    t.integer "rater_id"
    t.string "rateable_type"
    t.integer "rateable_id"
    t.float "avg", null: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["rateable_type", "rateable_id"], name: "index_average_caches_on_rateable_type_and_rateable_id"
    t.index ["rater_id"], name: "index_average_caches_on_rater_id"
  end

  create_table "comments", force: :cascade do |t|
    t.string "content"
    t.integer "user_id"
    t.integer "post_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "star"
    t.index ["post_id"], name: "index_comments_on_post_id"
    t.index ["user_id"], name: "index_comments_on_user_id"
  end

  create_table "impressions", force: :cascade do |t|
    t.string "impressionable_type"
    t.integer "impressionable_id"
    t.integer "user_id"
    t.string "controller_name"
    t.string "action_name"
    t.string "view_name"
    t.string "request_hash"
    t.string "ip_address"
    t.string "session_hash"
    t.text "message"
    t.text "referrer"
    t.text "params"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["controller_name", "action_name", "ip_address"], name: "controlleraction_ip_index"
    t.index ["controller_name", "action_name", "request_hash"], name: "controlleraction_request_index"
    t.index ["controller_name", "action_name", "session_hash"], name: "controlleraction_session_index"
    t.index ["impressionable_type", "impressionable_id", "ip_address"], name: "poly_ip_index"
    t.index ["impressionable_type", "impressionable_id", "params"], name: "poly_params_request_index"
    t.index ["impressionable_type", "impressionable_id", "request_hash"], name: "poly_request_index"
    t.index ["impressionable_type", "impressionable_id", "session_hash"], name: "poly_session_index"
    t.index ["impressionable_type", "message", "impressionable_id"], name: "impressionable_type_message_index"
    t.index ["user_id"], name: "index_impressions_on_user_id"
  end

  create_table "likes", force: :cascade do |t|
    t.integer "post_id"
    t.integer "user_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["post_id"], name: "index_likes_on_post_id"
    t.index ["user_id"], name: "index_likes_on_user_id"
  end

  create_table "mypages", force: :cascade do |t|
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.string "image"
  end

  create_table "overall_averages", force: :cascade do |t|
    t.string "rateable_type"
    t.integer "rateable_id"
    t.float "overall_avg", null: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["rateable_type", "rateable_id"], name: "index_overall_averages_on_rateable_type_and_rateable_id"
  end

  create_table "posts", force: :cascade do |t|
    t.string "title"
    t.text "body"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "user_id"
    t.string "image"
    t.integer "impressions_count"
  end

  create_table "rating_caches", force: :cascade do |t|
    t.string "cacheable_type"
    t.integer "cacheable_id"
    t.float "avg", null: false
    t.integer "qty", null: false
    t.string "dimension"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["cacheable_type", "cacheable_id"], name: "index_rating_caches_on_cacheable_type_and_cacheable_id"
  end

  create_table "users", force: :cascade do |t|
    t.string "email", default: "", null: false
    t.string "encrypted_password", default: "", null: false
    t.string "reset_password_token"
    t.datetime "reset_password_sent_at"
    t.datetime "remember_created_at"
    t.string "confirmation_token"
    t.datetime "confirmed_at"
    t.datetime "confirmation_sent_at"
    t.string "unconfirmed_email"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.boolean "admin", default: false
    t.string "name"
    t.boolean "accepted", default: false, null: false
    t.index ["email"], name: "index_users_on_email", unique: true
    t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
  end

end
  • 0
  • 0
anonymous タイトルなし
JavaScript
const number = numbers.filter((number)
  • 0
  • 0
anonymous タイトルなし
HTML
<!-- SAMPLE 01 -->
<div class="p-dropdown">
  <button class="p-dropdown__button js-dropdown-button" type="button" aria-controls="drop_contents_01" aria-expanded="false">〇〇のコンテンツについて見る</button>
  <div id="drop_contents_01" class="p-dropdown__contents js-dropdown-content" aria-hidden="true">
    〇〇のコンテンツ
  </div>
</div>

<!-- SAMPLE 02 -->
<div class="p-dropdown" aria-expanded="false">
  <button class="p-dropdown__button js-dropdown-button" type="button">△△のコンテンツについて見る</button>
  <div id="drop_contents_02" class="p-dropdown__contents js-dropdown-content" aria-hidden="true">
    △△のコンテンツ
  </div>
</div>
  • 3
  • 1
anonymous タイトルなし
HTML
<div class="p-dropdown">
  <button class="p-dropdown__button" type="button" aria-controls="drop_contents" aria-expanded="false">タブ</button>
  <div id="drop_contents" class="p-dropdown__contents" aria-hidden="true">
    コンテンツ内容
  </div>
</div>
  • 0
  • 0
anonymous タイトルなし
HTML
<div class="p-dropdown">
  <button class="p-dropdown__button" type="button" aria-controls="drop_contents" aria-expanded="false">タブ</button>
  <div id="drop_contents" class="p-dropdown__contents" aria-hidden="true">
    コンテンツ内容
  </div>
</div>
  • 0
  • 0