Skip to content

Instantly share code, notes, and snippets.

Avatar

Arata Tanaka ara-ta3

View GitHub Profile
@ara-ta3
ara-ta3 / .obsidian.vimrc
Created May 6, 2021
利用中のobsidian.vimrc Obsidian Vimrc Support version: 0.2.4
View .obsidian.vimrc
nmap <Esc><Esc> :nohl
nmap j gj
nmap k gk
nmap <DOWN> gj
nmap <UP> gk
imap jj <Esc>
imap <C-a> <Esc>0i
set clipboard=unnamed
View parse_ping.py
import argparse
from typing import NamedTuple, Dict
# 下記commandを前提にしてる
# ping -s 16 -i 1 -c 86400 google.com | LANG=C xargs -I_ gdate +'%c _' > ping.txt
def main():
parser = argparse.ArgumentParser()
parser.add_argument('infile', type=argparse.FileType('r', encoding='utf-8'))
parser.add_argument('--mode', type=str)
parser.add_argument('--csv', action='store_true')
@ara-ta3
ara-ta3 / MyUIPageViewController.swift
Created Oct 1, 2020
_UIPageViewControllerでウォークスルーダミー
View MyUIPageViewController.swift
import UIKit
import PlaygroundSupport
class MyViewController : UIPageViewController, UIPageViewControllerDataSource{
let first: UIViewController = FirstViewController()
let second: UIViewController = SecondViewController()
override func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = .white
View AutoLayoutでスクロールするScrollView.swift
import UIKit
import PlaygroundSupport
let width = 375
let height = 812
let view = UIView(frame: CGRect(x: 0, y: 0, width: width, height: height))
view.backgroundColor = .brown
PlaygroundPage.current.liveView = view
PlaygroundPage.current.needsIndefiniteExecution = true
View _SwiftのJSONDecoderを試す.md

swift json decode

Run

swift --version
Apple Swift version 5.2.4 (swiftlang-1103.0.32.9 clang-1103.0.32.53)
Target: x86_64-apple-darwin19.5.0
@ara-ta3
ara-ta3 / _JavaScriptワンライナー.md
Last active Jul 5, 2020
JavaScriptワンライナーまとめスレ
View _JavaScriptワンライナー.md

ワンライナーまとめスレ

View あつ森wikiのカブ価期待値.js
// https://hyperwiki.jp/acnh/kabu-tool/
// Array.from(document.querySelectorAll("#output tr")).filter((tr) => tr.className === '').map((tr) => {return { p: parseFloat(tr.childNodes[1].innerText.replace("%", "")), max: parseInt(tr.childNodes[16].innerText), min: parseInt(tr.childNodes[15].innerText)}}).map((x) => (x.max+x.min)/2 * (x.p / 100)).reduce((E, en) => E + en, 0)
Array.from(document.querySelectorAll("#output tr")).filter((tr) => tr.className === '').map((tr) => {
return {
p: parseFloat(tr.childNodes[1].innerText.replace("%", "")),
max: parseInt(tr.childNodes[16].innerText),
min: parseInt(tr.childNodes[15].innerText)
}
}).map((x) => (x.max + x.min) / 2 * (x.p / 100)).reduce((E, en) => E + en, 0)
View _コンパイル後のJSのthisの位置問題〜.md

コンパイル後にthisの位置問題でTypeError: Cannot read property 'bar' of undefinedになるになる