Skip to content

Instantly share code, notes, and snippets.

View johndstein's full-sized avatar

John Stein johndstein

View GitHub Profile
@johndstein
johndstein / long-query.sh
Last active June 12, 2018 13:08
Long Query
#!/usr/bin/env bash
set -euo pipefail
CHURCH="'012E0000000Q8x8IAC'"
FOUNDATION="'012E0000000Q8xDIAS'"
GOVERNMENT="'0124400000097hVAAQ'"
ORG="'012E0000000Q8xIIAS'"
echo "---------------------------------------------------------------------"
AuthorizeNetService ans = new AuthorizeNetService('**', '**', true);
AuthorizeNetModels.creditCardType creditCard = new AuthorizeNetModels.creditCardType();
creditCard.cardCode = '999';
creditCard.cardNumber = '5424000000000015';
creditCard.expirationDate = '2020-05';
AuthorizeNetModels.paymentType payment = new AuthorizeNetModels.paymentType();
payment.creditCard = creditCard;
@johndstein
johndstein / SamlJitHandler.java
Created January 31, 2018 20:17
Salesforce SAML JIT Handler
// This class provides logic for inbound just-in-time provisioning of single
// sign-on users in your Salesforce organization.
// Here's all the info we're going to have.
//
// Employee Id
// First Name
// Last Name
// Email
// Active Flag
@johndstein
johndstein / git-check.sh
Created January 8, 2018 15:16
Check if Git up to date
#!/usr/bin/env bash
set -e
#
# Check and see if I have been updated.
# If not, do nothing. If yes, run my deployment script.
#
# We can run this every minute.
# crontab -e
# * * * * * /home/ubuntu/glo.sh/bin/pullme.sh >/dev/null 2>&1
@johndstein
johndstein / LuminateSoapService.cls
Created November 14, 2017 11:06
Luminate Soap Service
/*
Handles all the communication with Luminate Online web service SOAP API.
*/
public class LuminateSoapService {
public static final String FORMAT = 'yyyy-MM-dd\'T\'HH:mm:ssZ';
public class MyException extends Exception {}
@johndstein
johndstein / csv-transform.js
Created November 3, 2017 11:32
Didn't help
'use strict';
const {
promisify
} = require('util');
function handle(err) {
console.error(err.stack || err);
process.exit(3);
}
@johndstein
johndstein / add-column.js
Created October 17, 2017 13:15
Add fixed value column to CSV file
#!/usr/bin/env node
'use strict';
const path = require('path');
if (process.argv.length < 4) {
console.error(`
Usage: ${path.basename(process.argv[1])} HEADER VALUE
@johndstein
johndstein / add-column.sh
Created October 17, 2017 13:14
Add fixed value column to CSV file
#!/usr/bin/env bash
if [ $# -lt 2 ]; then
me="$(basename "$(test -L "$0" && readlink "$0" || echo "$0")")"
echo ""
echo "Usage: $me HEADER VALUE"
echo ""
echo " We read from STDIN and write to STDOUT."
echo ""
exit 1
@johndstein
johndstein / image.js
Last active August 30, 2017 22:19
SQL Server Handle Image Data Type
// So this guy will pull down a bunch of word docs from SQL server
// and write them out to file.
// woo hoo.
const sql = require('mssql/msnodesqlv8');
const fs = require('fs');
const path = require('path');
const {promisify} = require('util');
const rimraf = promisify(require('rimraf'));
const mkdir = promisify(fs.mkdir);
// const writeFile = promisify(fs.writeFile);
@johndstein
johndstein / StackTrace_Test.java
Last active January 2, 2021 18:06
Salesforce APEX Stacktrace test if code is below given class.method
@isTest
private class StackTrace_Test {
public class MyException extends Exception {}
static testMethod void test() {
Test.StartTest();
someMethod();
Test.StopTest();
}