Skip to content

Instantly share code, notes, and snippets.

@ashitaka1963
ashitaka1963 / .markdown
Last active April 12, 2020 07:09
列折りたたみ
@ashitaka1963
ashitaka1963 / get_next_target_date.py
Last active April 13, 2020 13:04
来週の指定した曜日の日付を取得
import datetime
def get_next_target_date(date, target_week):
week = ['月','火','水','木','金','土','日']
# 曜日を数値型で取得
weekday = date.weekday()
# dateから指定した曜日までの加算日数を計算
add_days = 7 - weekday + week.index(target_week)
# dateに加算
@ashitaka1963
ashitaka1963 / get_max.py
Created April 13, 2020 22:20
要素の中から最大値を求める(max関数)
a=1
b=2
c=3
print(max(a,b,c)) # 3
@ashitaka1963
ashitaka1963 / create_Daily_file.py
Created April 14, 2020 10:15
日報ファイル作成スクリプト
import os
import datetime
def connect_str(base_str, add_str):
base_str += add_str
return base_str
WEEKDAY = ['月','火','水','木','金','土','日']
base_str = ''
@ashitaka1963
ashitaka1963 / math_Ceil.py
Created April 15, 2020 13:54
切り上げ
a = 2.2
b = 3.5
print(math.ceil(a)) # 3
print(math.ceil(b)) # 4
@ashitaka1963
ashitaka1963 / reverse_str.py
Last active April 16, 2020 23:00
文字列の反転
# 文字列
s='abc'
print(s[::-1]) # cba
# リスト
s=['a','b','c']
print(s[::-1]) # ['c', 'b', 'a']
@ashitaka1963
ashitaka1963 / デザインCSS.css
Last active April 18, 2020 01:44
グローバルナビゲーション
#nav{
background: #1F2123; /* ナビゲーションバー全体の背景色 */
}
#globalmenu{
width: 60%; /* ナビゲーションバークリック部分の背景色 */
margin: 0 auto 40px;
height: 50px; /* 高さ */
padding: 0;
list-style-type: none; /* リストのマーク非表示 */
@ashitaka1963
ashitaka1963 / exponentiation.py
Created April 18, 2020 23:45
べき乗演算子
n=2
for i in range(10):
print(n**i, end="")
print(" ", end="")
print(pow(n,i), end="")
print()
# 2 2
# 4 4
@ashitaka1963
ashitaka1963 / background.js
Last active April 23, 2020 22:11
DevToolsを非表示にする #Electron #Vue.js
function createWindow () {
// Create the browser window.
win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
}
})
@ashitaka1963
ashitaka1963 / cnt_str.py
Created April 24, 2020 12:35
特定文字列の数をカウント
s = "ZABCDBABCQ"
cnt = s.count("ABC")
print(cnt) # 2