Skip to content

Instantly share code, notes, and snippets.

@atomita
atomita / Add_Donwload_Button_to_Item_List_at_Qiita_Team.js
Last active December 25, 2024 10:45
Snippet: Add Donwload Button to Item List at Qiita Team
const accessToken = '{{https://qiita.com/settings/applications で個人用アクセストークンを発行し書き換え}}';
const articleSelector = 'article'; //'.css-1505ldx';
const linkSelector = '.css-uk6woj';
[...document.querySelectorAll(articleSelector)].map(article => {
const link = article.querySelector(linkSelector);
link.style.position = 'relative'; // absoluteで覆っていてclickできないので
const api = link.href.split('/').map((v, i) => i == 3 ? 'api/v2' : v).join('/');
function ifExpression (condition) {
if ('function' == typeof condition ? condition() : condition) {
return {
then: (callback) => {
const end = 'function' == typeof callback ? callback() : callback
const res = {
else: (callback) => ({
end
}),
elseif: (condition) => ({
@atomita
atomita / factorial.md
Last active September 12, 2019 01:17

Linux(Manjaro)をMac Book Pro(2016モデル)にinstallしたときの覚書

1. Macのディスクユーティリティでパーティションを作成

  • Macintosh HDを小さくして1つのpartitionを追加
    • とりあえずFATで
    • swapは必要になったらfileで作る
  • 8MBくらいのAPFSパーティションも自動で追加されてしまうのは気にしないでおく
  • やったら適用失敗になって50GBのpartitionが出来てたので、FATのを削除してexFATで作成
    • FAT32のpartition上限かな?
  • 適用し終わったら作成したpartitionの前後に"Apple_Boot"ってのが出来てた(disk0s3, disk0s5)
[].map.call(document.getElementsByTagName("table"),table => {
try {
let task = table.children[0].children[0].children[0].textContent
if ("task" == task) {
return [].map.call(table.children[1].children, record => {
let spend = record.children[2]
let text = spend.childNodes[0]
let times = text.nodeValue
if (times && /\d+:\d+(:\d+)?(\s*\+\s*\d+:\d+(:\d+)?)*/.test(times)) {
const prevPage = document.referrer
if (origin(createAnchor(prevPage)) === origin(window.location)) {
window.history.pushState(location.href, '', '/')
} else {
window.history.back()
}
function createAnchor(url) {
const anchor = document.createElement('a')
anchor.href = url
@atomita
atomita / pages.js
Last active February 6, 2019 02:56
function pages(current, max, length) {
return new Array(length * 2 - 1).fill(0) // 0埋めの配列(empty埋めの配列だとmapが実行されない)
.map((_, n)=> current + (Math.cos(Math.PI * n) * (n + 0.5) - 0.5) / -2) // current+0,current+1,current+-1,current+2...な配列にする
.filter((n)=> 0 < n && n <= max )
.slice(0, length)
.sort((a, b)=> a < b ? -1 : 1 );
}
// `Array.prototype.fill`が利用できない場合は
// `new Array(length * 2 - 1).fill(0)`を

注意点

  • 食品は持ち込み不可 (調理済み食品は可)
  • ビン、ガラス容器/製品の持ち込み不可

#買い出しリスト

飲料、調味料など