This file contains hidden or 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 browserFetchMock = () => { | |
const _fetch = window.fetch | |
window.fetch = (url) => { | |
const route = Object.keys(window._routes).find((route) => url.includes(route)) | |
return route | |
? new Promise((r1) => { | |
r1({ | |
json: () => new Promise((r2) => r2(window._routes[route])), | |
}) | |
}) |
This file contains hidden or 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
// @flow | |
export function formatPriceYen(price: number): string { | |
return `¥${formatPrice(price)}` | |
} | |
export function formatPriceYenMonth(price: number): string { | |
return `${formatPriceYen(price)}/月` | |
} |
This file contains hidden or 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
// yarn init | |
// yarn add puppeteer | |
// node check.js | |
const puppeteer = require('puppeteer'); | |
(async () => { | |
const browser = await puppeteer.launch() | |
const page = await browser.newPage() | |
await page.goto('http://www.cic.gc.ca/english/work/iec/selections.asp', { waitUntil: 'networkidle2' }) |
This file contains hidden or 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
{ | |
"hosting": { | |
"public": "public", | |
"rewrites": [ | |
{ | |
"source": "**", | |
"function": "app" | |
} | |
], | |
"redirects": [{ |
This file contains hidden or 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
// * install | |
// npm install -g node-wifi net-ping | |
// * usage | |
// node connect_starbucks_wifi.js | |
const ping = require('net-ping') | |
const wifi = require('node-wifi') | |
setInterval(connection, 5000) |
This file contains hidden or 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
/* @flow */ | |
import React, { Component } from 'react' | |
export default (keymaps: (props: Object) => Array<{ | |
keyCode?: number, | |
keyCodes?: Array<number>, | |
handler: Function, | |
shiftKey?: boolean, | |
altKey?: boolean, | |
ctrlKey?: boolean, |
This file contains hidden or 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 filter = require('lodash/fp/filter') | |
const map = require('lodash/fp/map') | |
const flow = require('lodash/fp/flow') | |
const omit = require('lodash/fp/omit') | |
const trim = require('lodash/fp/trim') | |
const get = require('lodash/fp/get') | |
const getOr = require('lodash/fp/getOr') | |
const has = require('lodash/fp/has') | |
const transform = require('lodash/fp/transform') |
This file contains hidden or 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 rp = require('request-promise'); | |
const options = { | |
uri: 'https://ntp-a1.nict.go.jp/cgi-bin/time', | |
transform: (body, response, resolveWithFullResponse) => { | |
return new Promise((resolve, reject) => { | |
if (response.statusCode !== 200) reject(); | |
resolve(response.body); | |
}); | |
} |
This file contains hidden or 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
#!/usr/bin/env node | |
# script filter(shell) | |
# {enter your node path} alfred-eslint-workflow.js "{query}" | |
# | |
# nodejs >= 5.0.0 | |
# | |
# require npm packages install command | |
# npm i superagent | |
# npm i alfred-item |