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
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
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
import React, { useState} from 'react' | |
import useSWR from 'swr' | |
import { fetcher } from './fetcher' | |
const ENDPOINT = 'https://unitrad.calil.jp/v1/' | |
const REGION = 'recipe' | |
export const useSwr = (q: string) => { | |
const [url, setUrl] = useState(`${ENDPOINT}/search?region=${REGION}&free=${encodeURIComponent(q)}`) | |
const [interval, setPollingInterval] = useState(100) |
OlderNewer