This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@IsTest public class SampleTestClass { | |
@IsTest public static void Test1() | |
{ | |
// upload a file in static resource first | |
StaticResourceCalloutMock mock = new StaticResourceCalloutMock(); | |
mock.setStaticResource('SampleResource'); // name of static resourc | |
mock.setStatusCode(200); | |
mock.setHeader('Content-Type', 'application/json'); // change with correct content type |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace app\models; | |
use Yii; | |
/** | |
* CLASS AS WRAPPER FOR SF REST API functions | |
* | |
* @author Yudi K. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* validates UEN of businesses in Singapore | |
* https://www.uen.gov.sg/ueninternet/faces/pages/admin/aboutUEN.jspx | |
* @param {string} uen | |
* @returns {boolean} | |
*/ | |
function validateUEN (uen) { | |
var debug = true; | |
const entityTypeIndicator = [ | |
'LP', 'LL', 'FC', 'PF', 'RF', 'MQ', 'MM', 'NB', 'CC', 'CS', 'MB', 'FM', 'GS', 'GA', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*// update metadata type that save the counter | |
Di contoh ini, Custom Metadata bernama OrderLineCounter__mdt | |
Custom fields : Prefix__c (text), Counter__c (integer) | |
Input adalah map<string, Integer> berisi daftar data yang ingin diupdate/insert (bisa lebih dari satu) | |
*/ | |
@future | |
public static void UpdateCounterMetadata(Map<String, Integer> mapCount) | |
{ | |
Map<String, OrderLineCounter__mdt> mapMDT = new Map<String, OrderLineCounter__mdt>(); // prefix -> metadata |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Utility { | |
// public get picklist options in map (string, string) | |
public static Map<String, String> getMapPicklist(String strObject, String strField) { | |
Map<String, String> options = new Map<String, String>(); | |
Map<String,Schema.SObjectType> gd = Schema.getGlobalDescribe(); | |
Map<String, Schema.SObjectField> field_map = gd.get(strObject).getDescribe().fields.getMap(); | |
List<Schema.PicklistEntry> picklistValues = field_map.get(strField).getDescribe().getPickListValues(); | |
for (Schema.PicklistEntry pv : picklistValues) { | |
// options.add(new SelectOption(pv.getValue(),pv.getLabel())); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Used to read a delimited file. | |
* https://gist.github.com/ngaller/858086 | |
*/ | |
public class SSSCsvReader { | |
private String delim = ','; | |
// the input data | |
private String[] buffer; | |
public SSSCsvReader(String data){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace app\models; | |
use Yii; | |
/** | |
* This is the custom model class for tables | |
* By Yudi K. | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace app\models; | |
class UserIdentity extends \yii\base\BaseObject implements \yii\web\IdentityInterface | |
{ | |
public $id; | |
public $username; | |
public $password; | |
public $authKey; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head><title>Simple Google Search API Example</title></head> | |
<body> | |
<h1>Simple Google Search API Example</h1> | |
<?php | |
// asumsi file ini ada di folder example, folder dengan level yang sama dengan src | |
require_once realpath(dirname(__FILE__) . '/../src/Google/autoload.php'); | |
$client = new Google_Client(); | |
$client->setApplicationName("Nama Aplikasi"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<apex:pageBlockTable var="items" value="{!listLead}" > | |
<apex:column headerValue="Lead"> | |
<apex:outputLink title="Lead" value="/{!items.Id}">{!items.name}</apex:outputLink> | |
</apex:column> | |
<apex:column title="Company" value="{!items.Company}" /> | |
<apex:column title="Phone" value="{!items.Phone}" /> | |
<apex:column title="Email" value="{!items.Email}" /> | |
</apex:pageblocktable> |
NewerOlder