Skip to content

Instantly share code, notes, and snippets.

Avatar

Eric Fung eskfung

View GitHub Profile
View override_necessary_consts_for_tests.js
jest.mock('@/constants', () => ({
...jest.genMockFromModule('@/constants'),
FOO: 'bar',
}))
View keybase.md

Keybase proof

I hereby claim:

  • I am eskfung on github.
  • I am eskfung (https://keybase.io/eskfung) on keybase.
  • I have a public key whose fingerprint is CB5E E4E7 AB34 85B7 3345 ED97 987A E3A2 215E AF80

To claim this, I am signing this object:

@eskfung
eskfung / ApplyAssignmentGroupsToCase.trigger
Created Dec 3, 2015
Apex for round robin assignments of Salesforce leads and cases.
View ApplyAssignmentGroupsToCase.trigger
trigger ApplyAssignmentGroupsToCase on Case (after update) {
Map<Id, Id> caseOwners = new Map<Id, Id>();
for (Case c : Trigger.new) {
if (Trigger.isUpdate) {
if (c.OwnerId != Trigger.oldMap.get(c.id).OwnerId) {
caseOwners.put(c.Id, c.OwnerId);
}
} else {
caseOwners.put(c.Id, c.OwnerId);
@eskfung
eskfung / km_json_to_csv.rb
Created Nov 20, 2014
KM People JSON to CSV
View km_json_to_csv.rb
require 'csv'
data = {
# simplifying returned results
"total" => nil,
"links" => [],
"metadata" => {},
"columns"=> [
{
"display_name"=>"KMID",
@eskfung
eskfung / KMTrackLeadConversion.trigger
Last active Oct 19, 2015
Notify KISSmetrics of Salesforce actions
View KMTrackLeadConversion.trigger
trigger KMTrackLeadConversion on Lead (after update) {
List<String> lead_ids = new List<String>();
for(Lead lead : Trigger.new) {
if(lead.IsConverted && !trigger.oldMap.get(lead.Id).IsConverted) {
lead_ids.add(lead.Id);
}
}
KMTracking.trackLeadsConverted(lead_ids);
}
@eskfung
eskfung / identity_tracking.erb
Last active Dec 24, 2015
How KISSmetrics uses the 'identify' API call.
View identity_tracking.erb
<!-- KISSmetrics -->
<script type="text/javascript">
var _kmq = _kmq || [];
var _kmk = _kmk || 'foo';
function _kms(u){
setTimeout(function(){
var d = document, f = d.getElementsByTagName('script')[0],
s = d.createElement('script');
s.type = 'text/javascript'; s.async = true; s.src = u;
f.parentNode.insertBefore(s, f);
@eskfung
eskfung / _analytics.html
Created Sep 30, 2013
Two examples of using the 'record' API call, within the KISSmetrics support site.
View _analytics.html
<!-- KISSmetrics -->
<script type="text/javascript">
var _kmq = _kmq || [];
var _kmk = _kmk || 'foo';
function _kms(u){
setTimeout(function(){
var d = document, f = d.getElementsByTagName('script')[0],
s = d.createElement('script');
s.type = 'text/javascript'; s.async = true; s.src = u;
f.parentNode.insertBefore(s, f);
You can’t perform that action at this time.