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
root = true | |
[*] | |
indent_style = space | |
end_of_line = lf | |
indent_size = 4 | |
charset = utf-8 | |
trim_trailing_whitespace = true | |
insert_final_newline = true |
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
/** | |
* Find common parent node | |
*/ | |
export function findCommonParent(...nodes) { | |
let nodeParents = nodes.map(node => findParents(node)), | |
firstNodeParents = nodeParents[0], | |
topParent = firstNodeParents[0]; | |
if (nodeParents.some(parents => parents.indexOf(topParent) !== 0)) { | |
// no common parent |
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 () { | |
const CLICK_ALLOWANCE = 5000; // ms | |
const KEYCODE_F5 = 116; | |
const KEYCODE_LETTER_R = 82; | |
const watchedElements = []; | |
let allowanceTimer = null; | |
function arr(nodelist) { |
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
window.__nightmare = {}; | |
__nightmare.ipc = require('electron').ipcRenderer; | |
__nightmare.sliced = require('sliced'); | |
// Listen for error events | |
window.addEventListener('error', function(e) { | |
__nightmare.ipc.send('page', 'error', e.message, e.error.stack); | |
}); | |
(function(){ |
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; |
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
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
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
+ (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
RCT_EXPORT_METHOD(generateUUIDs:(RCTResponseSenderBlock)callback) { | |
NSArray *uuidArr = [BCCrypto generateUUIDsForCount:50]; | |
callback(@[ | |
[NSNull null], | |
[uuidArr componentsJoinedByString:@","] | |
]); | |
} |