Skip to content

Instantly share code, notes, and snippets.

@tagty
tagty / react-hooks-use-effect-axios.md
Last active October 27, 2024 17:10
React Hooks で外部APIの情報を表示したいときにはどうすればよいのか?

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

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

useEffect の中で axios を使う

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

Updated Instructions for App Building

@bpteague Has an excellent update solution as of February 2025 using modern tools and an updated workflow.

This gist will remain here, but is deprecated. I'll keep it here historical and link-preservation purposes only. I strongly encourage everyone to check out the solution above!

Setup

  • Create a developer account with Apple
  • Download and install X-Code from the Apple App Store
@LeeDDHH
LeeDDHH / vim-control.md
Last active December 30, 2023 03:04
vim操作系のまとめ

置換で改行を削除する

:s/\n//g

文字列を一括削除

:%d

現在の行をコピー

@LeeDDHH
LeeDDHH / 0.md
Last active December 30, 2023 10:29
shell scriptに関するgistのまとめ(0_shell_script_link_index)
@LeeDDHH
LeeDDHH / bulletproof-react-project-structure.md
Created December 28, 2023 04:33
bulletproof-reactのプロジェクト構造について

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

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

src
|
+-- assets # 画像、フォントなどの静的ファイルを全て含む
|
+-- components # アプリケーション全体で使用される共有コンポーネント
@LeeDDHH
LeeDDHH / terminal-control.md
Created December 28, 2023 07:19
ターミナル操作で困ったときに見る

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

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

カーソルの移動

  • カーソルを行の先頭に移動
@OrionReed
OrionReed / dom3d.js
Last active April 19, 2025 12:06
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; // ¯\\_(ツ)_/¯