git add / git commit / git pushを取り消す
git addを取り消す
$ git reset HEAD ファイル名
#すべてのaddを取り消す
$ git reset HEAD .
覚えなくても、git statusでコマンドを確認できます。
$ git status On branch main Your branch is up to date with 'origin/main'. Changes to be committed: (use "git reset HEAD <file>..." to unstage) new file: newfile.txt
git commitを取り消す
直前のコミットを取り消す。
$ git reset --hard HEAD^
紐付いているリモートリポジトリを確認する
$ git remote -v #fetch元 origin https://github.com/user/project.git (fetch) #push先 origin https://guthub.com/user/project.git (push)
指定されたカラム名を持つテーブルを検索する
コード
select table_name, column_name from information_schema.columns where column_name = '検索したいカラム名' and table_schema = '検索対象のデータベース名';
コンストラクタとデストラクタ
コンストラクタ
コンストラクタ(constructor)は 、クラスのインスタンスが作られた直後に自動的に実行されるメンバ関数のこと。
メンバ関数とは
オブジェクト指向言語において、あるクラスのメソッドを定義する関数。
<?php public function __construct() { //処理 }
デストラクタ
デストラクタ(destructor)は、クラスのインスタンスが消える直前(オブジェクトが参照されなくなった時)に自動的に実行されるメンバ関数。
スクリプト終了時・unsetやnullを代入したときに、オブジェクトは破棄される。
<?php public function __destruct() { //処理 }
ブラウザからローカルのファイルを開く
やりたいこと
ブラウザからローカルのファイルシステム(Finder等)を開きたい
コード
<a href="file:///Users/User/Documents">Link</a>
⚠︎注意
chromeの場合は、ローカルファイルリンクが無効のため拡張機能を入れる必要がある。
ローカルファイルリンク有効化 - Chrome ウェブストア