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
| // Build a predictable shape first (fast-path for V8 hidden classes) | |
| function buildPoint(x, y) { | |
| return { x, y }; | |
| } | |
| // Introduce a second property in the same order every time. | |
| function translate(point, dx, dy) { | |
| point.x += dx; | |
| point.y += dy; | |
| return point; |
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 { inspectorGadget } = require("../../inspector"); | |
| const inspect = inspectorGadget( | |
| // Function to be profiled | |
| (nums) => { | |
| const tree = new AVL(); | |
| nums.forEach((n) => tree.add(n)); | |
| return { tree, nums }; | |
| }, | |
| // Function to prepare and provide args to above |
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
| // Below can be used to create a new CRUD resource resolver | |
| // Uncomment and replace "resource"/"Resource" w/name | |
| // import { BodegaResource, GetAllResponse, GraphQLContext } from '../../../../types/internal'; | |
| // export default { | |
| // Query: { | |
| // /** | |
| // * Gets the data for a single resource | |
| // */ |
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
| import React, { Component } from 'react'; | |
| import axios from 'axios'; | |
| import bt from 'braintree-web'; | |
| const HIPPO_PAY_PATH = 'http://localhost:3000'; | |
| const ADMIN_USERS_TOKEN = null; | |
| const token = ADMIN_USERS_TOKEN || 'VALID AUTH'; | |
| const ELEMENT_IDS = { | |
| ACCOUNT: 'card-number', | |
| CVV: 'cvv', |
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 authorization = yield UPS('braintree/client_token', token); | |
| const client = yield bt.client.create({ authorization }); | |
| async function initHostedFields(client, options) { | |
| const { errorHandler, fieldEventsCallback } = options; | |
| try { | |
| const hostedFields = await(bt.hostedFields.create({ | |
| client, | |
| styles: { | |
| 'input': { |
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 _ = require('lodash'); | |
| const Sequelize = require('sequelize'); | |
| const client = require('uas-data-store'); | |
| client.init({ | |
| database: { | |
| dropTables: false, | |
| name: 'uas', | |
| host: '127.0.0.1', | |
| dialect: "postgres", |
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
| function flattenForFun (array) { | |
| return !array.length ? [] : Array.isArray(array.slice(0,1)[0]) ? flattenForFun(array.slice(0,1)[0]).concat(flattenForFun(array.slice(1))) : array.slice(0,1).concat(flattenForFun(array.slice(1))); | |
| } | |
| function flattenRecursive (array) { | |
| if (array.length === 0) { | |
| return []; | |
| } | |
| let next = array.slice(0,1); | |
| let rest = array.slice(1); |