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
jest.mock('axios'); | |
axios.create.mockReturnThis(); | |
axios.get.mockResolvedValueOnce(Promise.resolve({ | |
data: myMockData | |
})); |
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
#! /usr/bin/env node | |
const parser = require('swagger-parser'); | |
const PATH = process.argv[2] | |
parser.dereference(PATH).then((document => { | |
console.log(JSON.stringify(document, null, 2)) | |
})) | |
// ./swagger-spec ./example/petstore.json > petstore-spec.json |
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
// project | |
// --path | |
// ----config.yml | |
// --path2 | |
// ----config.yml | |
// { project: { path: { config: object }, path2: { config: object } } } | |
const globby = require('globby'); | |
const fs = require('fs'); |
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 { Alert, Button, Col, Form, Modal } from 'react-bootstrap'; | |
import 'bootstrap/dist/css/bootstrap.min.css'; | |
const TestPage = () => { | |
const defaultIngredient = { name: '', amount: '' }; | |
const [ingredients, setIngredients] = useState([defaultIngredient]); | |
function addIngredient() { | |
setIngredients([...ingredients, defaultIngredient]); | |
} |
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
class CSVFormatter | |
def initialize | |
@buffer = [] | |
end | |
def result | |
@buffer.join("\n") | |
end | |
def section_title(title) |
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": "build-themes", | |
"version": "1.0.0", | |
"description": "build html themes in a single file", | |
"main": "webpack.config.js", | |
"directories": { | |
"lib": "lib" | |
}, | |
"scripts": { | |
"build": "npx webpack --config webpack.config.js", |
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 from 'react'; | |
import './App.css'; | |
import 'react-table/react-table.css'; | |
import 'react-bootstrap-table/dist/react-bootstrap-table-all.min.css'; | |
declare class App extends React.Component<{}, { | |
data: any; | |
loading: boolean; | |
}> { | |
constructor(props: any); | |
componentDidMount(): void; |
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 DefaultValue = defaultValue => | |
function(target, key) { | |
let _val = this[key]; | |
// delete old property | |
if (delete this[key]) { | |
Object.defineProperty(target, key, { | |
get: function() { | |
return !!_val ? _val : defaultValue; | |
}, |
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 axios, { AxiosInstance, AxiosRequestConfig } from "axios"; | |
import createAuthRefreshInterceptor from "axios-auth-refresh"; | |
import config from "../config"; | |
export const generateAuthHeader = authToken => | |
`Token api_key=${config.API_KEY}, auth_token=${authToken}`; | |
interface Storage { | |
get: (key: string) => Promise<string>; | |
set: (key: string, data: string) => Promise<string>; |
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 Holidays = require('date-holidays'); | |
import * as moment from 'moment'; | |
const holidays = new Holidays(process.env.LOCALE || 'ES'); | |
// https://developer.mozilla.org/es/docs/Web/JavaScript/Referencia/Objetos_globales/Date/getDay | |
const weekendDays = [6, 0]; | |
const isWeekEnd = (date: Date) => weekendDays.indexOf(date.getDay()) !== -1; | |
const filterAviableDates = (dates: Array<Date>) => { |
NewerOlder