Skip to content

Instantly share code, notes, and snippets.

addEventListener("fetch", (event) => {
const url = 'https://unitrad.calil.jp/v1/search?free=%E9%AC%BC%E6%BB%85%E3%81%AE%E5%88%83&region=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);
})
});
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) {
@deguchi
deguchi / converter.py
Created January 28, 2021 01:51
instagramのデータ変換
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')
/*
Unitrad UI APIライブラリ
Copyright (c) 2017 CALIL Inc.
This software is released under the MIT License.
http://opensource.org/licenses/mit-license.php
*/
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+\.]+/);
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
body{
margin: 0px;
}
const fs = require('fs');
const path = require('path');
const glob = require('glob');
const sass = require('node-sass');
const commandLineArgs = require('command-line-args');
// コマンドラインオプションの定義
const optionDefinitions = [
{
name: 'file',
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
html, body {
width: 100%;