Skip to content

Instantly share code, notes, and snippets.

@OrionReed
OrionReed / dom3d.js
Last active May 10, 2024 17:16
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯
@LeeDDHH
LeeDDHH / terminal-control.md
Created December 28, 2023 07:19
ターミナル操作で困ったときに見る

入力した値をすべて削除する

  • カーソル位置から行の先頭までの文字が削除する
    • Ctrl + U
  • カーソル位置から行末までを削除
    • Ctrl + K

カーソルの移動

  • カーソルを行の先頭に移動
@LeeDDHH
LeeDDHH / bulletproof-react-project-structure.md
Created December 28, 2023 04:33
bulletproof-reactのプロジェクト構造について

ルートディレクトリの全体像

ほとんどのコードは src ディレクトリにあり、以下のような構造になる

src
|
+-- assets # 画像、フォントなどの静的ファイルを全て含む
|
+-- components # アプリケーション全体で使用される共有コンポーネント
@LeeDDHH
LeeDDHH / 0.md
Last active December 30, 2023 10:29
shell scriptに関するgistのまとめ(0_shell_script_link_index)
@LeeDDHH
LeeDDHH / vim-control.md
Last active December 30, 2023 03:04
vim操作系のまとめ

置換で改行を削除する

:s/\n//g

文字列を一括削除

:%d

現在の行をコピー

Setup

  • Create a developer account with Apple
  • Download and install X-Code from the Apple App Store
  • Open and run X-Code app and install whatever extras it requires
  • Open the preferences pane (cmd+,)
    • click the + in the lower right corner
    • choose Apple ID
    • enter your apple ID and password
@tagty
tagty / react-hooks-use-effect-axios.md
Last active June 19, 2023 09:02
React Hooks で外部APIの情報を表示したいときにはどうすればよいのか?

React Hooks で外部APIの情報を表示したいときにはどうすればよいのか?

React で Hooks を使っているとします。 画面を表示した時に、外部APIから取得した情報を表示したい場合には、どうすればよいでしょうか?

useEffect の中で axios を使う

React Hooks で画面を表示したときに一度だけ処理を行いたいときには useEffect を使います。 外部APIにリクエストをするのに、今回は axios を使います。