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 { Component } from 'react' | |
import axios from 'axios' | |
import { updateAppBehavior } from './transition_factory_redux.js' | |
import { transitionFunction, getState, subscribe } from 'setup_transition_function.js' | |
const asyncFetchAction = (Component, action) => { | |
const CancelToken = axios.CancelToken; | |
return (dispatch, getState, actionGuard, actionType) => { |
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
/* | |
Modified with more card regexs | |
See initial source: https://www.regular-expressions.info/creditcard.html | |
*/ | |
let visa = /^4[0-9]{12}(?:[0-9]{3,4})?$/ | |
let visa_local = /^4[19658][7684][0785][04278][128579](?:[0-9]{10})$/ | |
let mastercard = /^(?:5[1-5][0-9]{2}|222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}$/ | |
let mastercard_local = /^(?:5[13]99|55[35][19]|514[36])(?:11|4[10]|23|83|88)(?:[0-9]{10})$/ |
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
/** | |
* check if a literal is falsy or not | |
*/ | |
const isLiteralFalsey = (variable) => { | |
return variable === '' || variable === false || variable === 0 | |
} | |
/** | |
* check if a variable contains a reference type (not a literal) | |
*/ |
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
/** cURL - User Agent String Variations Regex in JS | |
* | |
* See: http://www.useragentstring.com/pages/useragentstring.php?name=cURL | |
* See: https://jonlabelle.com/snippets/view/yaml/browser-user-agent-regular-expressions | |
*/ | |
; /* Headless UserAgent(s) */ | |
const healessUAs = /\b(Windows-Update-Agent|Microsoft-CryptoAPI|SophosUpdateManager|SophosAgent|Debian APT-HTTP|Ubuntu APT-HTTP|libcurl-agent|libwww-perl|urlgrabber|curl|Wget|OpenBSD ftp|jupdate)(?:[ /](\d+)(?:\.(\d+)(?:\.(\d+))?)?)?/ | |
; /* cURL Headless UserAgent */ | |
const curlUA = /^curl\/((?:\d)\.(?:\d{1,2})(?:\.(?:\d|x))?) \((?:[\-_\w\.]+)\) libcurl(\/| )\1 \(?(?:(SSL|OpenSSL|NSS)\2(\d)\.(\d{1,2})\.\d([a-z]?)(\.\d)?)?\)?(?: (zlib\/(\d)\.(\d)\.(\d)|\(ipv6 enabled\)))?(?: (libidn\/(?:\d)\.(?:\d{1,2})))?(?: (libssh2\/(?:\d)\.(?:\d{1,2})))?$/i |
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 { useState } from 'preact/hooks'; | |
import fetch from 'isomorphic-fetch'; | |
/** | |
* `useSync` was created to abstract the stateful logic for managing rest/graphql | |
* requests ( fetches / queries / mutations ) in such a manner as to not repeat similar logic | |
* in different components across the project and to be made instantly reusable in | |
* these components. The implementation is highly functional | |
* ( lots of function composition and argument currying ). | |
* |
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
if (typeof InstallTrigger === "undefined") { // If the browser isn't a Gecko-based browser (e.g. Firefox) | |
Object.defineProperty(Error.prototype, 'columnNumber', { | |
configurable: false, | |
enumerable: false, | |
get: function () { | |
const stackString = (this.stack || '').toString(); | |
const regexStackFrameLine = /at (?:(?:[\w ])+) \(([^:]+)\:([\d]+)\:([\d]+)\)\s*/g | |
const [ _, fileName, lineNumber, columnNumber ] = regexStackFrameLine.exec(stackString) || [ '', '<anonymous>', '1', '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
// Type definitions for react-table 7.7.0 | |
// Project: https://github.com/tannerlinsley/react-table | |
// Definitions by: Guy Gascoigne-Piggford <https://github.com/ggascoigne>, | |
// Michael Stramel <https://github.com/stramel> | |
// Rohit Garg <https://github.com/gargroh> | |
// Jason Clark <https://github.com/riceboyler> | |
// Definitions: https://gist.github.com/isocroft | |
// TypeScript Version: 4.x+ | |
// reflects react-table@7.7.0 | |
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
query GetUserFriendsAndLikes ($id: Int!) { | |
getUserFriendsAndLikes (id: $id) @httpCompressed(mode: "incremental") { | |
first_name | |
last_name | |
age | |
gender | |
friends @defer { | |
first_name | |
last_name | |
age |
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
type User { | |
name: String! | |
age: Int! | |
salary: Float! | |
} | |
type Query { | |
getAllUsers (id: ID!, page: Int!, pageSize: Int!): [User!] @httpCached(action: "check", freshness: 1, validation: 0) | |
} |
OlderNewer