Share Code Quickly

What is Harigami?

Harigami is a simple source code sharing service. You can share source code by an URL which is issued after submission.
You can also run your source code online such as Python, Ruby, JavaScript and so on.
For free.Use for code review.
Preferences
トミー hoverで回転
CSS
<!DOCTYPE html>
/* 回転軸からずれてるように見えます。何故? */
<html lang="ja">
  <head>
    <meta charset="utf-8" />
    <title>hoverで回転</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <style type="text/css">
      .rotate_test {
        transform: rotateX(0deg); /* 軸を基準点に回転する */
      }
      .rotate_test:hover {
        transform: rotateX(180deg); /* 軸を基準点に回転する */
      }
      .rotate_test , .rotate_test:hover {
        transition: transform 1s linear;
        transform-origin:10 0;
        display:inline-block;
      }      
    </style>
  </head>
  <body>
    <div class="rotate_test">
      <span>
      <svg width="200" height="200" xmlns="http://www.w3.org/2000/svg">
        <rect x="0" y="0" width="200" height="200" fill="aqua"/>
        <line x1="0" y1="0" x2="100" y2="200" style="stroke:rgb(0,0,0);stroke-width:1"></line>
        <line x1="100" y1="200" x2="200" y2="0" style="stroke:rgb(0,0,0);stroke-width:1"></line>
      </svg>
      </span>
    </div>
  </body>
</html>
anonymous No title
C#
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Tilemaps;

public class SetTileShadow : MonoBehaviour
{
    [SerializeField] Tilemap tile;
    [SerializeField] int length = 8;

    private void OnValidate()
    {
        if (!tile) tile = GetComponent<Tilemap>();
    }

    private void Start()
    {
        Set();
    }

    public void Set()
    {
        tile.CompressBounds();
        var bound = tile.cellBounds;

        System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
        sw.Start();
        //最初に全タイルを黒くする
        for (int x = bound.min.x; x < bound.max.x; x++)
        {
            for (int y = bound.min.y; y < bound.max.y; y++)
            {
                Color b = Color.black;
                if (tile.HasTile(new Vector3Int(x, y, 0))) tile.SetColor(new Vector3Int(x, y, 0), b);
            }
        }

        //上から下に白を広げる
        for (int x = bound.min.x; x < bound.max.x; x++)
        {
            for (int y = bound.min.y + 5; y < bound.max.y; y++)
            {
                if (!tile.HasTile(new Vector3Int(x, y + 1, 0)) && tile.HasTile(new Vector3Int(x, y, 0)))
                {
                    for (int f = 0; f <= length; f++)
                    {
                        float tc = tile.GetColor(new Vector3Int(x, y - f, 0)).r;
                        float c = ((float)length - f) / (float)length;
                        float b = Mathf.Max(tc, c);
                        tile.SetColor(new Vector3Int(x, y - f), new Color(b, b, b, 1));

                        //更に左に影響を与える
                        for (int fx = 0; fx < length - f; fx++)
                        {
                            float ftc = tile.GetColor(new Vector3Int(x - fx, y - f, 0)).r;
                            float fc = Mathf.Lerp(0, b, (((float)length - f) - fx) / (float)length);
                            float fb = Mathf.Max(ftc, fc);
                            tile.SetColor(new Vector3Int(x - fx, y - f), new Color(fb, fb, fb, 1));
                        }

                        //更に右に影響を与える
                        for (int fx = 0; fx < length - f; fx++)
                        {
                            float ftc = tile.GetColor(new Vector3Int(x + fx, y - f, 0)).r;
                            float fc = Mathf.Lerp(0, b, (((float)length - f) - fx) / (float)length);
                            float fb = Mathf.Max(ftc, fc);
                            tile.SetColor(new Vector3Int(x + fx, y - f), new Color(fb, fb, fb, 1));
                        }
                    }
                }
            }
        }

        //左から右にに白を広げる
        for (int x = bound.max.x - 5; x > bound.min.x; x--)
        {
            for (int y = bound.min.y; y < bound.max.y; y++)
            {
                if (!tile.HasTile(new Vector3Int(x - 1, y, 0)) && tile.HasTile(new Vector3Int(x, y, 0)))
                {
                    for (int f = 0; f <= length; f++)
                    {
                        float tc = tile.GetColor(new Vector3Int(x + f, y, 0)).r;
                        float c = ((float)length - f) / (float)length;
                        float b = Mathf.Max(tc, c);
                        tile.SetColor(new Vector3Int(x + f, y), new Color(b, b, b, 1));

                        //更に下に影響を与える
                        for (int fy = 0; fy < length - f; fy++)
                        {
                            float ftc = tile.GetColor(new Vector3Int(x + f, y - fy, 0)).r;
                            float fc = Mathf.Lerp(0, b, (((float)length - f) - fy) / (float)length);
                            float fb = Mathf.Max(ftc, fc);
                            tile.SetColor(new Vector3Int(x + f, y - fy), new Color(fb, fb, fb, 1));
                        }

                        //更に上に影響を与える
                        for (int fy = 0; fy < length - f; fy++)
                        {
                            float ftc = tile.GetColor(new Vector3Int(x + f, y + fy, 0)).r;
                            float fc = Mathf.Lerp(0, b, (((float)length - f) - fy) / (float)length);
                            float fb = Mathf.Max(ftc, fc);
                            tile.SetColor(new Vector3Int(x + f, y + fy), new Color(fb, fb, fb, 1));
                        }
                    }
                }
            }
        }

        //下から上に白を広げる
        for (int x = bound.min.x; x < bound.max.x; x++)
        {
            for (int y = bound.max.y - 5; y > bound.min.y; y--)
            {
                if (!tile.HasTile(new Vector3Int(x, y - 1, 0)) && tile.HasTile(new Vector3Int(x, y, 0)))
                {
                    for (int f = 0; f <= length; f++)
                    {
                        float tc = tile.GetColor(new Vector3Int(x, y + f, 0)).r;
                        float c = ((float)length - f) / (float)length;
                        float b = Mathf.Max(tc, c);
                        tile.SetColor(new Vector3Int(x, y + f), new Color(b, b, b, 1));

                        //更に左に影響を与える
                        for (int fx = 0; fx < length - f; fx++)
                        {
                            float ftc = tile.GetColor(new Vector3Int(x - fx, y + f, 0)).r;
                            float fc = Mathf.Lerp(0, b, (((float)length - f) - fx) / (float)length);
                            float fb = Mathf.Max(ftc, fc);
                            tile.SetColor(new Vector3Int(x - fx, y + f), new Color(fb, fb, fb, 1));
                        }

                        //更に右に影響を与える
                        for (int fx = 0; fx < length - f; fx++)
                        {
                            float ftc = tile.GetColor(new Vector3Int(x + fx, y + f, 0)).r;
                            float fc = Mathf.Lerp(0, b, (((float)length - f) - fx) / (float)length);
                            float fb = Mathf.Max(ftc, fc);
                            tile.SetColor(new Vector3Int(x + fx, y + f), new Color(fb, fb, fb, 1));
                        }
                    }
                }
            }
        }

        //右から左にに白を広げる
        for (int x = bound.min.x + 5; x < bound.max.x; x++)
        {
            for (int y = bound.min.y; y < bound.max.y; y++)
            {
                if (!tile.HasTile(new Vector3Int(x + 1, y, 0)) && tile.HasTile(new Vector3Int(x, y, 0)))
                {
                    for (int f = 0; f <= length; f++)
                    {
                        float tc = tile.GetColor(new Vector3Int(x - f, y, 0)).r;
                        float c = ((float)length - f) / (float)length;
                        float b = Mathf.Max(tc, c);
                        tile.SetColor(new Vector3Int(x - f, y), new Color(b, b, b, 1));

                        //更に下に影響を与える
                        for (int fy = 0; fy < length - f; fy++)
                        {
                            float ftc = tile.GetColor(new Vector3Int(x - f, y - fy, 0)).r;
                            float fc = Mathf.Lerp(0, b, (((float)length - f) - fy) / (float)length);
                            float fb = Mathf.Max(ftc, fc);
                            tile.SetColor(new Vector3Int(x - f, y - fy), new Color(fb, fb, fb, 1));
                        }

                        //更に上に影響を与える
                        for (int fy = 0; fy < length - f; fy++)
                        {
                            float ftc = tile.GetColor(new Vector3Int(x - f, y + fy, 0)).r;
                            float fc = Mathf.Lerp(0, b, (((float)length - f) - fy) / (float)length);
                            float fb = Mathf.Max(ftc, fc);
                            tile.SetColor(new Vector3Int(x - f, y + fy), new Color(fb, fb, fb, 1));
                        }
                    }
                }
            }
        }

        sw.Stop();
        Debug.Log($"陰をつける処理にかかった時間 : {sw.ElapsedMilliseconds} ms");
    }
}
anonymous No title
CSS
@charset "utf-8";

/*ナビゲーションの固定*/

nav{
/*stickyで固定*/
position: -webkit-sticky;/*Safari*/
position: sticky;
/*固定したい位置*/
top: 100px;
/*ナビゲーションの形状*/
background:#fff;
padding: 20px;
height:1200px;

}

/*レイアウトのためのCSS*/
#container{
display: flex;
justify-content: space-between;
flex-wrap: wrap;
}

#main-area{
width:90%;
}

#sub-area{
width:5%;
padding: 0px 20px 0 0;
}

.g-navi{
position:fixed;
vertical-align: bottom;
}

でできんんんんん!!!!
anonymous No title
JavaScript
function ageCheck(){
    if( confirm("20歳以上ですか?")){
        alert("お酒が飲めますね!");
    }
    else {
        alert("20歳まで我慢しましょう!");
    }
}

ageCheck();
anonymous No title
JavaScript
document.evaluate("a//[contains(text(),'クリック')]",document.null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);
anonymous No title
Python
def to_bin(x,ans):
    #print(x, ans)
    if x == 0:
        return ''.join(reversed(list(map(str,ans))))
    else:
        ans.append(x%2)
        return to_bin(x//2, ans)

while True:
    v = int(input())
    print(to_bin(v, []))
anonymous No title
JavaScript
//1HのstochRSIを表示
mtf = input.timeframe(title='MTF算出_60分', defval='60')
mtf_rsi = request.security(syminfo.tickerid, mtf, rsi1)
mtf_k = ta.sma(ta.stoch(mtf_rsi, mtf_rsi, mtf_rsi, lengthStoch), smoothK)
mtf_d = ta.sma(mtf_k, smoothD)

//エントリー条件を記述 条件を満たせばtrue扱いとなる
entry = ta.crossover(k,d) and ta.crossover(mtf_k,mtf_d)

//アラート条件
alertcondition(entry, title='エントリー例', message='1Dと1hのstochGC')
anonymous No title
JavaScript
class BlockChain {

  constructor(nemesisHash, timestamp, message) {
    this.chain = [{
      height: 0,
      hash: nemesisHash,
      timestamp: 0,
      epochAjustment: timestamp,
      message: message,
    }];
    console.log("Start BlockChain");
    console.log(JSON.stringify(this.chain[0], null, 2));
  }

  static __init__() {
    const nemesisMessage = "hello block chain Symbol !!";
    const nemesisHashRow = Utilities.computeDigest(Utilities.DigestAlgorithm.SHA_256, nemesisMessage);
    const nemesisHash = nemesisHashRow.map(n => ("0" + ((n < 0) ? 256 + n : n).toString(16)).slice(-2)).join("").toUpperCase();
    const timestamp = new Date().getTime();
    return new BlockChain(nemesisHash, timestamp, nemesisMessage);
  }

  add() {
    const message = new Date().toLocaleString() + " Blockを追加しました";
    const lastBlock = this.chain[this.chain.length - 1];
    const epochAjustment = this.chain[0].epochAjustment;
    const date = new Date().getTime();
    if (this.hashSum() === true) {
      const hashRow = Utilities.computeDigest(Utilities.DigestAlgorithm.SHA_256, `${lastBlock.hash}${message}`);
      const hash = hashRow.map(n => ("0" + ((n < 0) ? 256 + n : n).toString(16)).slice(-2)).join("").toUpperCase();
      const block = { height: this.chain.length, hash, timestamp: date - epochAjustment, message, epochAjustment: undefined };
      console.log(JSON.stringify(block, null, 2))
      this.chain.push(block);
    } else {
      throw new Error("データの改竄があった為、停止しました");
    }
  }

  hashSum() {
    if (this.chain.length === 1) {
      return true;
    }
    for (let i = 1; i < this.chain.length; i++) {
      const prev = this.chain[i - 1];
      const current = this.chain[i];
      const currentHashRow = Utilities.computeDigest(Utilities.DigestAlgorithm.SHA_256, `${prev.hash}${current.message}`);
      const currentHash = currentHashRow.map(n => ("0" + ((n < 0) ? 256 + n : n).toString(16)).slice(-2)).join("").toUpperCase();
      if (currentHash !== current.hash) return false;
    }
    return true;
  }

}

function test() {
  const Chain = BlockChain.__init__();
  for (let i = 0; i < 50; i++) {
    Utilities.sleep(1000);
    Chain.add();
    // 改竄
    if(i === 10){
      console.log("データを改竄しました");
      Chain.chain[5].message = "改竄します";
    }
  }
}
anonymous No title
VBA
With ws調整シート

    .Range(.Rows(R1st調整範囲), .Rows(RLast調整範囲)).AutoFit
    
    Dim R As Long
    For R = R1st調整範囲 To RLast調整範囲
        .Rows(R).RowHeight = WorksheetFunction.MIN _
            (.Rows(R).RowHeight, 最大行高)
    Next
    
End With
anonymous テキスト選択禁止を解除するブックマークレットだよ
Public Domain JavaScript
javascript:document.body.appendChild((function(){var s=document.createElement('style');s.innerHTML='* { user-select: initial !important; -webkit-user-select: initial !important; }'; return s})());var ss = function() { event.stopImmediatePropagation(); return true; }; document.querySelectorAll('*').forEach(function(e) { e.addEventListener('selectstart', ss, true); });