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 fs = require("fs"); | |
| const file = fs.readFileSync(__dirname + "/input.txt", { encoding: "utf-8" }); | |
| const depths = file.split('\n').map(Number); | |
| const threeMeasurements = depths.map((first, index) => { | |
| if (index > depths.length - 3) return null; | |
| const second = depths[index + 1]; | |
| const third = depths[index + 2]; | |
| return first + second + third; | |
| }).filter(x => x != null); |
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
| // Available variables: | |
| // - Machine | |
| // - interpret | |
| // - assign | |
| // - send | |
| // - sendParent | |
| // - spawn | |
| // - raise | |
| // - actions |
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
| // Available variables: | |
| // - Machine | |
| // - interpret | |
| // - assign | |
| // - send | |
| // - sendParent | |
| // - spawn | |
| // - raise | |
| // - actions |
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
| // Available variables: | |
| // - Machine | |
| // - interpret | |
| // - assign | |
| // - send | |
| // - sendParent | |
| // - spawn | |
| // - raise | |
| // - actions |
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
| // Available variables: | |
| // - Machine | |
| // - interpret | |
| // - assign | |
| // - send | |
| // - sendParent | |
| // - spawn | |
| // - raise | |
| // - actions |
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 from "react"; | |
| import { notify } from '@vendure/ui-devkit'; | |
| import { gql } from 'graphql-tools'; | |
| import { useGetProductsLazyQuery, useToggleEnabledMutation } from './generated-by-codegen'; | |
| // These queries get detected and processed by graphql-codegen | |
| const GET_PRODUCTS = gql` | |
| query GetProducts($skip: Int, $take: Int) { | |
| products(options: { skip: $skip, take: $take }) { | |
| items { id, name, enabled }, |
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
| // Available variables: | |
| // - Machine | |
| // - interpret | |
| // - assign | |
| // - send | |
| // - sendParent | |
| // - spawn | |
| // - raise | |
| // - actions |
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
| correct = [0, 0, 0]; | |
| incorrect = [0, 0, 0]; | |
| for i in range(10000): | |
| (correct if train_data.correct[i] == 1 else incorrect)[train_data.group_name[i]].append(1); | |
| plt.hist(correct[0], color='blue', label='correct_0') | |
| ...etc |
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 reducer(state, action) { | |
| switch (action.type) { | |
| case UPDATE_VOTES: | |
| const updateVotesList = state.polls.map((poll, ind) => { | |
| if (ind === action.question) { | |
| return poll.answers.map((ans, index) => | |
| index === action.index | |
| ? { ...ans, votes: ans.votes + action.votes } | |
| : ans; | |
| ); |
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 crypto from 'crypto'; | |
| // Docs: https://docs.adyen.com/developers/payments/accepting-payments/hmac-signature-calculation | |
| export default function generateSignature(body, hmacKey) { | |
| const keys = Object | |
| .keys(body) | |
| // Step 1: Sort by keys | |
| .sort(); | |
| const values = keys |
NewerOlder