This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async getOpenBDInfo(item): Promise<any> { | |
const books = await fetch('https://api.openbd.jp/v1/get?isbn='+item.isbn).then(r => r.json()).catch(error => console.log(error)) | |
if (books.length>0) { | |
const book = books[0] | |
console.log(book) | |
// 紹介・目次 | |
let description = null | |
let descriptionLong = null | |
let tableOfContents = null | |
const CollateralDetails = book.onix.CollateralDetail.TextContent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 144ページで、写真に使えるのは142ページ(1ページ目はタイトル) | |
// 2020は、captionData.length - 142 = 41 | |
// 後期は、A5サイズの44ページで | |
// | |
let captionData = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs') | |
var sass = './src/sass/index.sass'; | |
fs.readFile(sass, 'utf8', function (err,data) { | |
if (err) { | |
return console.log(err); | |
} | |
// console.log(data) | |
var result = data.replace(/([\d+\.]+)rem/g, function(match) { | |
console.log(match) | |
var m = match.match(/[\d+\.]+/); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const buildQueryString = (params) => { | |
let parts = []; | |
let add = (key, value) => { | |
parts.push(encodeURIComponent(key) + '=' + encodeURIComponent(value)); | |
} | |
for (let key in params) { | |
let param = params[key]; | |
if (Array.isArray(param)) { | |
param.map((value) => { | |
add(key, value); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getQueryString() { | |
var params = {} | |
location.search.substr(1).split('&').map(function(param) { | |
var pairs = param.split('='); | |
params[pairs[0]] = decodeURIComponent(pairs[1]); | |
}); | |
return params; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
addEventListener("fetch", (event) => { | |
const url = 'https://unitrad.calil.jp/v1/search?free=%E9%AC%BC%E6%BB%85%E3%81%AE%E5%88%83®ion=openbd-future' | |
fetch(url).then(r => r.json()).then(data => { | |
const response = new Response(JSON.stringify(data), { | |
headers: { "content-type": "application/json; charset=utf-8" }, | |
}); | |
event.respondWith(response); | |
}) | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const detectBrowser = () => { | |
const userAgent = window.navigator.userAgent.toLowerCase(); | |
if(userAgent.indexOf('msie') != -1 || | |
userAgent.indexOf('trident') != -1) { | |
return 'ie' | |
} else if(userAgent.indexOf('edge') != -1) { | |
return 'edge' | |
} else if(userAgent.indexOf('chrome') != -1) { | |
return 'chrome' | |
} else if(userAgent.indexOf('safari') != -1) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import datetime | |
import shutil | |
f = open('./instagram_ source_data/media.json', 'r') | |
data = json.load(f) | |
photos = data['photos'] | |
for photo in photos: | |
taken_at = photo['taken_at'] | |
tdatetime = datetime.datetime.strptime(taken_at, '%Y-%m-%dT%H:%M:%S%z') |