Skip to content

Instantly share code, notes, and snippets.

View sukeharu's full-sized avatar

Sukeharu Kano sukeharu

View GitHub Profile
@sukeharu
sukeharu / concatenate-props-with-spread-syntax.js
Created June 4, 2024 06:27
オブジェクト全体ではなく、プロパティを結合することも可能
// オブジェクトのプロパティを結合することも可能
const withProp1 = {
n: 1,
o: {
prop1: 'p1',
prop2: 'p2',
},
};
const withProp2 = {
n: 1,
@sukeharu
sukeharu / concatenate-object-with-spread-syntax.js
Created June 4, 2024 06:23
スプレッド構文でオブジェクトを結合する
// スプレッド構文でオブジェクトを結合する
// オブジェクトfirst、オブジェクトsecondを結合してオブジェクトthirdを作る
const first = {
a: 1,
b: 2,
c: 3,
};
const second = {
d: 4,
e: 5,
@sukeharu
sukeharu / copy-object-with-spread-syntax.js
Created June 4, 2024 06:18
スプレッド構文を使ってオブジェクトをコピー
// スプレッド構文でオブジェクトをコピーする
const original = {
a: 1,
b: 2,
c: 3,
};
const copied = {...original};
console.log(copied); // {a: 1, b: 2, c: 3}
@sukeharu
sukeharu / list-style.html
Last active May 8, 2020 06:27
2020/05/08現在、list-style-typeに指定できる、日本語に関連するキーワード。
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>list-style</title>
<style>
p > code {
padding-left: 0.5rem;
}
@sukeharu
sukeharu / hugo_shortcodes_gist.md
Created November 4, 2018 02:55
Hugo Shortcodes embed GitHub Gist

{{< gist username document_name >}}

@sukeharu
sukeharu / hugo_shortcodes_figure.md
Last active October 2, 2022 11:02
Hugo Shortcodes embed <figure> tag

Basic usage:
{{< figure src="path/to/image.png" >}}

add figcaption:
{{< figure src="path/to/image.png" caption="figure caption" >}}

set width:
{{< figure src="path/to/image.png" caption="figure caption" width="500" >}}

@sukeharu
sukeharu / four-digit.scpt
Last active June 2, 2017 07:07
Get four digit numbers as string from the right end of the unix time number, then set it to the clipboard by AppleScript.
set d to (do shell script "d=`date +%s`;echo ${d:(-4)}")
set the clipboard to d
@sukeharu
sukeharu / openInTerminalAndSublimeText.scpt
Last active May 6, 2017 11:25
Open in Terminal and Sublime Text AppleScript
on run {input, parameters}
tell application "Terminal"
activate
tell front document
do script "cd " & input & "; subl ."
end tell
end tell
return input
@sukeharu
sukeharu / scrivener.md
Last active September 7, 2016 10:35
Scrivener で自分がよくやる操作メモ

Scrivener で自分がよくやる操作メモ

  • 選択したテキストをドキュメントのタイトルにする(英語メニュー:Documents -> Set Selected Text as Title)
opt + shift + cmd + T
  • リンクの名前をリンク先のタイトルで更新する(英語メニュー:Edit -> Update Links To Use Target Title)
@sukeharu
sukeharu / redirect.md
Last active July 13, 2016 16:49
Apache 2.x で、特定のディレクトリを除きリダイレクトする方法。

Apache 2.x で、特定のディレクトリを除いてリダイレクト

サイトのすべてのファイルを http://www.example.com にリダイレクトする。ただし、dir1ディレクトリ以下は除外する(リダイレクトしない)。

RedirectMatch 301 "^/((?!dir1).*)$" http://www.example.com/

除外するディレクトリが複数ある場合、たとえばdir1だけでなくdir2以下も除外するときはこうする。

RedirectMatch 301 "^/((?!(dir1|dir2)).*)$" http://www.example.com/