Skip to content

Instantly share code, notes, and snippets.

View bdunn313's full-sized avatar

Brad Dunn bdunn313

View GitHub Profile

My cool blog article

@bdunn313
bdunn313 / request.xml
Created January 8, 2020 14:19
originalLegalEntity not serialized properly in WorldPay C# SDK
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<legalEntityCreateRequest
xmlns="http://preprod-url">
<legalEntityName>Yarrgh Pirate Co.</legalEntityName>
<legalEntityType>INDIVIDUAL_SOLE_PROPRIETORSHIP</legalEntityType>
<legalEntityOwnershipType>PRIVATE</legalEntityOwnershipType>
<doingBusinessAs>Jolly Roger Services</doingBusinessAs>
<taxId>551351516</taxId>
<contactPhone>5555555555</contactPhone>
<annualCreditCardSalesVolume>0</annualCreditCardSalesVolume>
@bdunn313
bdunn313 / ubuntu-setup.sh
Last active November 26, 2019 22:17
Setup ubuntu (wsl)
# Install zsh
sudo apt update && sudo apt install -y zsh
# Install oh-my-zsh
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# Node/NPM/Yarn
sudo apt install -y npm
something.
// Reference: https://facebook.github.io/react-native/docs/flatlist.html
class MultiSelectList extends React.PureComponent {
state = {selected: (new Map(): Map<string, boolean>)};
_keyExtractor = (item, index) => item.id;
_onPressItem = (id: string) => {
// updater functions are preferred for transactional updates
this.setState((state) => {
// List
const prefs = new Map();
// Toggle
const togglePref = (prefName) => {
prefs.set(prefName, !prefs.get(prefName));
return;
}
@bdunn313
bdunn313 / settings-list-naive.js
Created January 30, 2018 00:44
Settings List: naive solution
// Track
let preferences = {
allowNotifications: false,
shareLocation: false,
showFullName: false,
};
// Toggle
const togglePref = (prefName) => {
preferences[prefName] = !preferences[prefName];
@bdunn313
bdunn313 / documenting-js-projects-flow-example.js
Created January 8, 2018 15:54
documenting-js-projects-flow-example
// @flow
/**
* Adds two numbers together
*/
function add(first: number, second: number): number {
return first + second;
}
@bdunn313
bdunn313 / documenting-js-projects-basic-example.js
Created January 8, 2018 14:57
documenting-js-projects-basic-example
/**
* Adds two numbers together
*
* @param {number} first The First Number
* @param {number} second The Second Number
* @returns {number}
*/
function add(first, second) {
return first + second;
}
<?php
// Normal php conditional
if (true) {
echo 'This normal one is true!';
} else {
echo 'Its false';
}
// Alternative syntax
if (true):