Skip to content

Instantly share code, notes, and snippets.

View scottmcclung's full-sized avatar

Scott McClung scottmcclung

View GitHub Profile
@scottmcclung
scottmcclung / sfdeploy.sh
Last active April 26, 2023 12:17
Shell script to deploy metadata from a Salesforce DX project to a sandbox or production org.
#!/bin/bash
# Script to simplify the sfdx process of creating and deploying a metadata package
# from an SFDX project. The script expects to be placed in the SFDX project root directory.
#
# Example usage:
# sfdeploy <mode> <target> <tests>
# sfdeploy test uat local
# sfdeploy test uat all
# sfdeploy test uat test1,test2,test3
@scottmcclung
scottmcclung / ExampleCallback.js
Created May 13, 2017 20:19
Example of Lightning Components for handling Apex Callback Errors
action.setCallback(this, function(a){
if (a.getState() === "SUCCESS") {
//happy path stuff
} else if (a.getState() === "ERROR"){
var appEvent = $A.get("e.c:handleCallbackError");
appEvent.setParams({
"errors" : a.getError(),
"errorComponentName" : "someUniqueName"
});
appEvent.fire();

Raspberry Pi VPN Router

This is a quick-and-dirty guide to setting up a Raspberry Pi as a "router on a stick" to PrivateInternetAccess VPN.

Requirements

Install Raspbian Jessie (2015-09-24-raspbian-jessie.img) to your Pi's sdcard.

Use the Raspberry Pi Configuration tool or sudo raspi-config to:

@scottmcclung
scottmcclung / UuidPrimaryKey.php
Last active May 22, 2016 23:15 — forked from danb-humaan/UuidModel.php
Trait for implementing UUIDs in Laravel models
<?php
namespace App\Traits;
use Ramsey\Uuid\Uuid;
/**
* Trait UuidPrimaryKey
* @package App\Traits
*/
@scottmcclung
scottmcclung / CustomPermissionsReader.cls
Last active August 29, 2015 14:26 — forked from afawcett/CustomPermissionsReader.cls
CustomPermissionsReader
/**
* Copyright (c), Andrew Fawcett
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright notice,
@scottmcclung
scottmcclung / zip_code_with_timezone.sql
Created July 27, 2013 05:43
sql version of zip codes with timezone
CREATE TABLE `zipcodes_with_timezone` (
`zip` varchar(5) CHARACTER SET utf8 DEFAULT NULL,
`timezone` varchar(45) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
INSERT INTO `zipcodes_with_timezone` (`zip`, `timezone`) VALUES
('00501', 'America/New_York'),
('00544', 'America/New_York'),
('01001', 'America/New_York'),
('01002', 'America/New_York'),
@scottmcclung
scottmcclung / zip_code_with_timezone.txt
Created July 27, 2013 05:36
Comma separated list of zip codes with timezone id
This file has been truncated, but you can view the full file.
"zip","timezone"
"00501","America/New_York"
"00544","America/New_York"
"01001","America/New_York"
"01002","America/New_York"
"01003","America/New_York"
"01004","America/New_York"
"01005","America/New_York"
"01007","America/New_York"
@scottmcclung
scottmcclung / csv.awk
Created July 8, 2013 00:28
AWK script for parsing and reconstructing CSV data files. Originally written by Lorance Stinson...I've just made a few tweaks to this for my own use.
#!/usr/bin/awk -f
########################### AWK CSV Parser ###########################
# #
# ********** This file is in the public domain. ********** #
# #
# Use this source in any way you wish. #
# Feedback and bug reports would be appreciated. #
# As would a note about what how you are using it. #
# #