Skip to content

Instantly share code, notes, and snippets.

View metadaddy's full-sized avatar

Pat Patterson metadaddy

View GitHub Profile
@metadaddy
metadaddy / GoogleInternalRegHandler.cls
Created September 12, 2013 23:24
Simplest possible registration handler for OpenID Connect login from Google.
global class GoogleInternalRegHandler implements Auth.RegistrationHandler{
global User createUser(Id portalId, Auth.UserData data){
User u = [SELECT Id FROM user WHERE GoogleID__c =: data.identifier];
return u;
}
global void updateUser(Id userId, Id portalId, Auth.UserData data){
}
}
@metadaddy
metadaddy / CitrixAuth.psm1
Last active April 14, 2021 20:29
Wrapper on Invoke-WebRequest to handle Citrix Cloud authentication, including token expiry
<#
MIT License
Copyright 2021, Citrix Systems, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
<apex:page >
<apex:includeScript value="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.2.min.js"/>
<script>
jQuery(document).ready(function($) {
$('#queryform').submit(function(){
$.ajax($('#query').val(),
{
beforeSend: function(xhr) {
xhr.setRequestHeader('Authorization', 'Bearer {!$Api.Session_ID}');
},
@metadaddy
metadaddy / Validate JSON Data.json
Created May 9, 2019 04:25
StreamSets Data Collector 3.8.0 pipeline to Validate JSON against a schema
{
"pipelineConfig" : {
"schemaVersion" : 6,
"version" : 12,
"pipelineId" : "ValidateJSONDatab0dfa94e-faf3-42ec-9a02-5122d048fe4c",
"title" : "Validate JSON Data",
"description" : "",
"uuid" : "d504e9d3-d4ea-4d52-8fd8-565592400d2e",
"configuration" : [ {
"name" : "executionMode",
@metadaddy
metadaddy / S3 to Azure Synapse.json
Last active November 7, 2019 21:54
Use StreamSets Cloud to read data from Amazon S3 and write to Azure Synapse (formerly SQL DW)
{
"ciConfig" : null,
"currentExternalCIStatus" : null,
"currentRules" : {
"commitId" : "55b9a63d-8712-4a8d-96bf-511618889159:dpmfrancois",
"definitionRemoveMessage" : null,
"definitionRemoveTime" : 0,
"definitionRemover" : null,
"id" : "d53e9e53-eb4c-4204-9227-fd40d3a1b440:dpmfrancois",
"message" : "Committed with pipeline",
@metadaddy
metadaddy / portalauth.php
Created May 24, 2012 21:40
Calling Force.com SOAP API on behalf of a portal user
<?php
require_once ('soapclient/SforcePartnerClient.php');
function get_resource($url, $access_token) {
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER,
array("Authorization: OAuth $access_token"));
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
{
"pipelineConfig" : {
"schemaVersion" : 6,
"version" : 12,
"pipelineId" : "personalbox4f3590a2-1b4e-40ac-beae-600e976ef496",
"title" : "personal_box",
"description" : "",
"uuid" : "043a4e85-7989-4761-90de-e68401257e9e",
"configuration" : [ {
"name" : "executionMode",
{
"pipelineConfig" : {
"schemaVersion" : 6,
"version" : 12,
"pipelineId" : "Metrics635c20ed-872c-48d7-87fb-7043ab937ae6",
"title" : "Metrics",
"description" : "",
"uuid" : "08bce59b-151b-47d4-97dc-5d4f58da9672",
"configuration" : [ {
"name" : "executionMode",
@metadaddy
metadaddy / CustomTransformer.scala
Last active September 27, 2018 03:42
Creating a StreamSets Spark Transformer in Scala - after third code expansion
package com.streamsets.spark.scala
import com.streamsets.pipeline.api.Field
import com.streamsets.pipeline.api.Record
import com.streamsets.pipeline.spark.api.SparkTransformer
import com.streamsets.pipeline.spark.api.TransformResult
import org.apache.spark.api.java.JavaPairRDD
import org.apache.spark.api.java.JavaRDD
import org.apache.spark.api.java.JavaSparkContext
import org.apache.spark.rdd.RDD
@metadaddy
metadaddy / CustomTransformer.scala
Last active September 27, 2018 03:42
Creating a StreamSets Spark Transformer in Scala - after second code expansion
package com.streamsets.spark.scala
import com.streamsets.pipeline.api.Field
import com.streamsets.pipeline.api.Record
import com.streamsets.pipeline.spark.api.SparkTransformer
import com.streamsets.pipeline.spark.api.TransformResult
import org.apache.spark.api.java.JavaPairRDD
import org.apache.spark.api.java.JavaRDD
import org.apache.spark.api.java.JavaSparkContext
import org.apache.spark.rdd.RDD