Skip to content

Instantly share code, notes, and snippets.

pomu0325 / gist:8b55608a9ca02dd5390b
Created Nov 27, 2015
update Task.WhoId to ConvertedContactId for invisible Tasks related to converted Leads (Shared Activities enabled)
View gist:8b55608a9ca02dd5390b
Map<Id, Lead> ls = new Map<id, lead>([select Id, ConvertedAccountId, ConvertedContactId from Lead where IsConverted = true]);
Task[] ts = [select WhoId, WhatId, (select Id from TaskRelations) from Task where WhoId in :ls.keySet()];
TaskRelation[] deletes = new TaskRelation[]{};
TaskRelation[] inserts = new TaskRelation[]{};
for (Task t : ts) {
for (TaskRelation tr : t.TaskRelations) {
pomu0325 / gist:7476fb447e2280d975d6
Created Feb 12, 2015
sample code: Post Chatter feed with ActionLink
View gist:7476fb447e2280d975d6
ConnectApi.ActionLinkGroupDefinitionInput defInput = new ConnectApi.ActionLinkGroupDefinitionInput();
defInput.templateId = '07gB00000004CB9'; // Id for ActionLinkGroup
ConnectApi.ActionLinkGroupDefinition def = ConnectApi.ActionLinks.createActionLinkGroupDefinition(null, defInput);
ConnectApi.AssociatedActionsCapabilityInput actionCapabilityInput = new ConnectApi.AssociatedActionsCapabilityInput();
actionCapabilityInput.actionLinkGroupIds = new String[]{};
// Add ActionLink to capability
ConnectApi.FeedElementCapabilitiesInput capabilitiesInput = new ConnectApi.FeedElementCapabilitiesInput();
View LeadConvert
<apex:page showHeader="false" sidebar="false" standardController="Lead">
<div style="overflow:scroll; width:100%; height:100%;">
<object type="text/html" data="/lead/leadconvert.jsp?retURL=%2{!id}&id={!id}&isdtp=nv"
style="overflow:scroll; width:1200px; height:2400px;">
pomu0325 / fdc-patch.js
Created Dec 17, 2011
hacked FDC.ForceOAuth
View fdc-patch.js
var o = {}; = function(clientId) {
o.clientId = clientId;;
o.apiVersion = FDC.ForceOAuth.apiVersion;
o.makeRestCall = function (path, callback, error, method, payload, retry) {
pomu0325 / gist:1443640
Created Dec 7, 2011
patched sample source (example/app.js) originally bundled with SalesForce Toolkit for Appcelerator 1.0
View gist:1443640
// this sets the background color of the master UIView (when there are no windows/tab groups on it)
var FDC = require('com.salesforce');
Ti.API.debug("What what?");
Ti.API.debug("Here is the FDC thingy\n" + JSON.stringify(FDC));
var bWidth = "200";
var view1 = Titanium.UI.createScrollView({
pomu0325 / gist:1168507
Created Aug 24, 2011
comparing >- and >#
View gist:1168507
def time(fn: => Unit) = {
val start = System.currentTimeMillis
println("%d ms".format(System.currentTimeMillis - start))
import dispatch._
import json._
import JsHttp._
pomu0325 / GenTypeConstraints.scala
Created Aug 14, 2011 — forked from kmizu/GenTypeConstraints.scala
Hacking generalized type constraints.
View GenTypeConstraints.scala
object GenTypeConstraints {
abstract class =:=|[F,A,B] extends (F => Either[A,B])
object =:=| {
implicit def eqA[F,X]: =:=|[F,F,X] = new =:=|[F,F,X] {def apply(v:F) = Left(v)}
implicit def eqB[F,X]: =:=|[F,X,F] = new =:=|[F,X,F] {def apply(v:F) = Right(v)}
def main(args: Array[String]) {
pomu0325 /
Created Apr 21, 2011
NullPointerException at org.slim3.datastore.ModelQuery.asQueryResultList(
package pomu0325.model;
import static;
import static org.junit.Assert.assertThat;
import org.junit.Test;
import org.slim3.datastore.Datastore;
import org.slim3.datastore.S3QueryResultList;
import org.slim3.tester.AppEngineTestCase;
View ATNDApi.scala
import java.util.Date
import java.text.SimpleDateFormat
import scala.xml._
import scala.xml.parsing.XhtmlParser
case class User( userId:Int, nickname:String, twitterId:Option[String], join:Boolean = true )
class Event( eventId:String, eventXml:Node ) {
lazy val usersXml = XML.load( new URL( "" format eventId ))
You can’t perform that action at this time.