Skip to content

Instantly share code, notes, and snippets.

View brianbier's full-sized avatar
:octocat:

Brian Bier brianbier

:octocat:
View GitHub Profile
@brianbier
brianbier / sfdx-throttle-platformevents.apex
Created November 4, 2021 18:04 — forked from c4tch/sfdx-throttle-platformevents.apex
Throttle Apex Platform Events to avoid overloading trigger DML
/**
* Entrypoint from the Trigger, dispatch the events here
* Bobby White
* The use case is universal... you're never going to be able to consume 2000 PE in a single Apex transaction if the PE are independent.
* You have to "clip" the executions into manageable chunks.
* Best case N = 200, in practice if the DML's will touch objects that are poorly governed, it could hit limits at a lower number like 25 or 50.
* Q: What is "Independent"?
* A: Let's say that you had a flood of PE's that had the applied to the same ExternalId, you might be able to consume these with a single DML (e.g. 10 meter readings for the same Meter, or a series of notifications for the same Client) -- if your use case doesn't demand that you preserve every state change, you could collapse them into one. My default assumption is that you need to design your PE trigger with the premise that the PE's stand alone and have no correlation to other PE's in the same invocation.
* I get you, so in the PE loop you have here you might collapse sim
@brianbier
brianbier / salesforce.js
Created July 14, 2019 17:41 — forked from cweems/salesforce.js
Salesforce Message Push
exports.handler = function(context, event, callback) {
//================================================================================
// Modules
//================================================================================
var querystring = require('querystring');
var request = require('request');
//================================================================================
@brianbier
brianbier / vim-heroku.sh
Created November 25, 2018 03:01 — forked from dvdbng/vim-heroku.sh
Run vim in heroku updated 2017
mkdir ~/vim
cd ~/vim
# Staically linked vim version compiled from https://github.com/ericpruitt/static-vim
# Compiled on Jul 20 2017
curl 'https://s3.amazonaws.com/bengoa/vim-static.tar.gz' | tar -xz
export VIMRUNTIME="$HOME/vim/runtime"
export PATH="$HOME/vim:$PATH"
cd -
@brianbier
brianbier / Lookup.cmp.html
Created June 22, 2018 17:09 — forked from JitendraZaa/Lookup.cmp.html
Salesforce Lightning Lookup component - Pure SLDS and Javascript based
<aura:component controller="Lookup">
<aura:attribute Name="selItem" type="object" access="public"
description="This attribute can be used by parent component to read selected record"/>
<aura:attribute Name="server_result" type="object[]" access="private" />
<aura:attribute name="lookupIcon" type="String" access="public" default="standard:contact"/>
<aura:attribute name="objectName" type="String" access="public"
description="Name of Object to be searched"/>
<aura:attribute name="field_API_text" type="String" access="public"
@brianbier
brianbier / progressRing.cmp
Created June 13, 2018 16:45 — forked from brianmfear/progressRing.cmp
LightningProgressRing component
<aura:component >
<aura:attribute name="value" type="Integer" default="0" />
<aura:attribute name="variant" type="String" />
<aura:attribute name="hasVariant" type="Boolean" access="private" default="{!false}" />
<aura:attribute name="ringClass" type="String" access="private" />
<aura:attribute name="iconName" type="String" access="private" />
<aura:attribute name="altText" type="String" access="private" />
<aura:handler name="init" value="{!this}" action="{!c.updateView}" />
@brianbier
brianbier / progressRing.cmp
Created June 13, 2018 16:45 — forked from brianmfear/progressRing.cmp
LightningProgressRing component
<aura:component >
<aura:attribute name="value" type="Integer" default="0" />
<aura:attribute name="variant" type="String" />
<aura:attribute name="hasVariant" type="Boolean" access="private" default="{!false}" />
<aura:attribute name="ringClass" type="String" access="private" />
<aura:attribute name="iconName" type="String" access="private" />
<aura:attribute name="altText" type="String" access="private" />
<aura:handler name="init" value="{!this}" action="{!c.updateView}" />
@brianbier
brianbier / gh_script.rb
Created June 12, 2016 14:27 — forked from ltw/gh_script.rb
A script to check GitHub's status.
require 'json'
require 'net/http'
status = nil
until status == 'good'
url = URI('https://status.github.com/api/status.json')
response = Net::HTTP.get(url)
body = JSON.parse(response)
p body
status = body['status']