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 { applyMiddleware, createStore } from "redux"; | |
| import { createSyncMiddleware, syncStore } from "redux-browser-extension-sync/background"; | |
| import rootReducer from "../reducers/index.js"; | |
| const syncMiddleware = createSyncMiddleware(); | |
| const store = syncStore(createStore( | |
| rootReducer, | |
| applyMiddleware(syncMiddleware) | |
| )); |
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 { Service } = require("vulpes"); | |
| // Create a new service | |
| const service = new Service(); // Service takes an optional storage parameter | |
| // Initialise the service | |
| await service.initialise(); |
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 fetch = require("node-fetch"); | |
| const chalk = require("chalk"); | |
| const prettyMs = require("pretty-ms"); | |
| const VError = require("verror"); | |
| const pruddy = require("pruddy-error"); | |
| const API = "https://api-zcash.flypool.org"; | |
| const DELAY = 60; | |
| const MINER = "t1R21Uq3HQRiyj6ff1kFQcPusqPXiBaAc2U"; | |
| //const PAYOUT_MIN = 0.03; |
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 mem from "mem"; | |
| const ELEMENT_STYLE_CACHE_TIME = 3000; | |
| let __memoizedGetElementStyle; | |
| export function getElementOffset(target) { | |
| __memoizedGetElementStyle = __memoizedGetElementStyle || mem(getElementStyle, { maxAge: ELEMENT_STYLE_CACHE_TIME }); | |
| const boundingRect = target.getBoundingClientRect(); | |
| const bodyStyle = __memoizedGetElementStyle(document.body); |
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
| RCT_EXPORT_METHOD(generateUUIDs:(RCTResponseSenderBlock)callback) { | |
| NSArray *uuidArr = [BCCrypto generateUUIDsForCount:50]; | |
| callback(@[ | |
| [NSNull null], | |
| [uuidArr componentsJoinedByString:@","] | |
| ]); | |
| } |
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
| + (NSString *)encryptText:(NSString *)text withKey:(NSString *)key andSalt:(NSString *)salt andHMAC:(NSString *)hmacHexKey { | |
| // Validation | |
| if (key.length != 64) { | |
| return @"Error:Invalid key length"; | |
| } else if (hmacHexKey.length != 64) { | |
| return @"Error:Invalid authentication information or possible tampering"; | |
| } | |
| // Data prep | |
| NSString *iv = [BCCrypto generateIVHex]; | |
| NSData *ivData = [BCHelpers dataFromHexString:iv]; |
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
| public static String encryptText(String text, String keyHex, String saltHex, String hmacHexKey) { | |
| String ivHex = generateIV(); | |
| byte[] ivData = BCHelpers.hexStringToByteArray(ivHex); | |
| byte[] keyData = BCHelpers.hexStringToByteArray(keyHex); | |
| byte[] hmacKeyData = BCHelpers.hexStringToByteArray(hmacHexKey); | |
| IvParameterSpec iv = new IvParameterSpec(ivData); | |
| SecretKeySpec skeySpec = new SecretKeySpec(keyData, "AES"); | |
| try { | |
| // AES encryption | |
| Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5PADDING"); |
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
| subtleCrypto.importKey( | |
| "raw", | |
| stringToArrayBuffer(password), | |
| { name: "PBKDF2" }, | |
| false, // not extractable | |
| ["deriveBits"] | |
| ) |
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
| { | |
| "name": "project", | |
| "version": "0.0.0", | |
| "scripts": { | |
| "format": "prettier --tab-width 4 --print-width 120 --write 'source/**/*.js'", | |
| "precommit": "lint-staged", | |
| "test": "echo \"nothing yet\"", | |
| "test:format": "prettier-check --tab-width 4 --print-width 120 'source/**/*.js'" | |
| }, | |
| "lint-staged": { |
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 logo from './logo.svg'; | |
| import './App.css'; | |
| const firstNames = ["Perry", "Linda", "Tom", "Noora", "Daniel"]; | |
| const lastNames = ["Mitchell", "Damario", "Jerry", "Suojansalo", "Bailo"]; | |
| function getName() { | |
| const numFirstNames = firstNames.length; | |
| const numLastNames = lastNames.length; |