I hereby claim:
- I am ifwu on github.
- I am nicesprite (https://keybase.io/nicesprite) on keybase.
- I have a public key ASBg0axWWnoiputR8Aohw7w3aDMyPE3cRJlKBiMc5SfEPQo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
import {Number} from "ts-toolbelt" | |
type Even_<a extends string> = { | |
0: true, | |
1: false, | |
2: Even_<Number.Minus<a, "2">> | |
}[a extends "0" ? 0 : a extends "1" ? 1 : 2] | |
type Even<a extends number> = a extends unknown ? Even_<Number.NumberOf<a>> : never | |
type AssertEven<a extends any[]> = Even<a["length"]> extends true ? a : unknown |
const transTo = (target) => ({ | |
target, | |
actions: sendParent({ type: 'TODO_STATUS_UPDATE', value: target }), | |
}); | |
const todoStatusMachine = Machine({ | |
id: 'TodoStatus', | |
states: { | |
Active: { | |
on: { |
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
Todo& | |
State | |
Active* | |
Completed | |
Todos& | |
Filter State | |
all -> Filter All | |
active -> Filter Active | |
completed -> Filter Completed | |
Filter All* | |
Filter Active | |
Filter Completed |
const { promisifyAll, promisify } = require('bluebird'); | |
const request = promisify(require('request')); | |
promisifyAll(request, { multiArgs: true }); | |
const cheerio = require('cheerio'); | |
module.exports.handler = async function(req, resp, context) { | |
const articleTitle = req.queries.articleTitle; | |
console.log(articleTitle); | |
const commentId = req.queries.commentId; | |
const commentAnchor = commentId ? `#comment-${commentId}` : ''; |
function validURL(str) { | |
var pattern = new RegExp( | |
'^(https?:\\/\\/)?' + // protocol | |
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' + // domain name | |
'((\\d{1,3}\\.){3}\\d{1,3}))' + // OR ip (v4) address | |
'(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' + // port and path | |
'(\\?[;&a-z\\d%_.~+=-]*)?' + // query string | |
'(\\#[-a-z\\d_]*)?$', | |
'i' | |
); // fragment locator |
<template> | |
<table> | |
<thead> | |
<tr> | |
<th | |
v-for="key in columns" | |
:key="key" | |
@click="sortBy(key)" | |
:class="{ active: sortKey == key }" | |
> |