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 moment = function moment(textValue: string | number, format: string) { | |
const timeOfTheDay = /^([0-9]{1,2}):([0-9]{1,2})$/.exec((textValue || "").trim()) | |
const onlyTime = timeOfTheDay && new Date() | |
if (onlyTime && timeOfTheDay) onlyTime.setHours(parseInt(timeOfTheDay[1]), parseInt(timeOfTheDay[2])) | |
const date = !textValue ? new Date() : | |
!isNaN(textValue as number) ? new Date(textValue) : | |
!(textValue as string).trim() ? new Date() : | |
onlyTime ? onlyTime : new Date(textValue) | |
return { | |
date, |
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 CardType = 'MasterCard' | 'Visa' | 'American Express' | | |
'JCB' | 'Diners Club' | 'Discover' | 'unknown' | |
type MajorIndustryIdentifier = | |
'ISO/TC 68' | 'Airlines' | 'Travel and entertainment and banking/financial' | | |
'Banking and financial' | 'Merchandising and banking/financial' | | |
'Petroleum' | 'Healthcare and telecommunications' | 'National assignment' | | |
'unknown' | |
type CreditCardGuessedInformation = { |
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
package org.toilelibre.libe | |
import java.lang.reflect.Method | |
import kotlin.math.pow | |
import kotlin.reflect.KFunction | |
import kotlin.reflect.full.companionObject | |
import kotlin.reflect.full.companionObjectInstance | |
import kotlin.reflect.full.declaredFunctions | |
import kotlin.reflect.full.memberProperties |
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
package xmltomap; | |
import java.util.ArrayDeque; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.Collections; | |
import java.util.Deque; | |
import java.util.HashMap; | |
import java.util.HashSet; | |
import java.util.List; |
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
package com.myservice.infra.testinterceptor | |
import com.fasterxml.jackson.databind.ObjectMapper | |
import org.springframework.http.HttpRequest | |
import org.springframework.http.HttpStatus | |
import org.springframework.http.client.ClientHttpRequestExecution | |
import org.springframework.http.client.ClientHttpRequestInterceptor | |
import org.springframework.http.client.ClientHttpResponse | |
import org.springframework.mock.http.client.MockClientHttpResponse | |
import java.io.File |
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
fun main(args: Array<String>) { | |
val choosenMenu = menu { | |
fish | |
chips | |
hamburger | |
} | |
println(choosenMenu) | |
} |
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
{ | |
"name": "yamlchecker", | |
"version": "0.0.1", | |
"private": true, | |
"dependencies": { | |
"yamljs": "latest" | |
}, | |
"devDependencies": { | |
"webpack": "latest" | |
} |
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 {get} = require('axios') | |
const unzip = require('yauzl') | |
const eventStream = require('event-stream') | |
const keys = { | |
agency: ['agency_id'], | |
stops: ['stop_id'], | |
calendar: ['service_id'], | |
calendar_dates: ['date', 'service_id'], | |
routes: ['route_id'], |
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 benchmark = ({theContestants, howManyTimes, forThisWork, barSettings, asText, logInConsole, seedInit}) => { | |
const timestamp = () => { | |
const hrTime = process.hrtime(); | |
return hrTime[0] * 1000000 + hrTime[1] / 1000 | |
} | |
const asNumbers = (name, duration) => `[${name.padStart(20)}]: ${`${(duration).toFixed(5)}`.padStart(15)} µs, ${`${((duration) / 1000).toFixed(0)}`.padStart(5)} ms, ${`${((duration) / 1000000).toFixed(2)}`.padStart(5)} s` | |
const asBar = (between0And1, histogramDisplay = barSettings) => { | |
const peak = between0And1 * histogramDisplay.width | |
const interval = histogramDisplay.width / histogramDisplay.gradient.length |