Skip to content

Instantly share code, notes, and snippets.

View 402332509's full-sized avatar

Harry 402332509

View GitHub Profile
import {
login,
queryGenerator,
deleleSobject,
query,
executeAnonymous,
} from "@common/promisify-js-force";
import { chunk } from "lodash";
export const main_handler = async (event, context, callback) => {
@402332509
402332509 / Mock.cls
Created August 29, 2019 10:07 — forked from afawcett/Mock.cls
Mocking SOQL result set containing sub-selects
/**
* Copyright (c), Andrew Fawcett
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright notice,
@402332509
402332509 / DeleteApexLogs.js
Last active July 15, 2019 09:49
Truly delete all Apex logs in your org.
var loadScript = (src)=>{
return new Promise( (resolve, reject)=>{
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = src;
script.onload = resolve;
script.onerror = reject;
document.head.appendChild(script);
} );
@402332509
402332509 / .cls
Created October 11, 2017 01:50
amazon customer reviews apex spider
List<String> targetList = new List<String>{'B01LR7151C','B06XY77N5N','B072J83YSM','B019YHGHX8','B01K5BTJH8','B01GIIVF6K','B003F6WENW','B0027TEADK','B012PJVQ7Y','B01IG0E1F0','B0072V6MIO','B0727TW22T','B01G7UJIVI','B01AIW6KZS','B00MH78O0M','B0756T5CD4'};
for(String target: targetList){
HttpRequest req = new HttpRequest();
Http http = new Http();
req.setEndpoint('https://www.amazon.com/product-reviews/'+target);
req.setMethod('GET');
// req.setBody('{}');
@402332509
402332509 / Lookup
Last active July 20, 2017 09:53
Best Practice of AngularJS and SLDS
<apex:page standardController="b25efasiav1__Course_Map__c" extensions="Ctrl_Create_CourseMap">
<head>
<apex:stylesheet value="{!URLFOR($Resource.SLDS, 'assets/styles/salesforce-lightning-design-system.min.css')}" />
<style>
body {
font-size: 75%;
}
</style>
</head>
String key = 'hgdhdhhdjfh12ehsn';
String secret = 'DNf32sdsj747dhkjd8893jjjdjds7jjk';
//Generating current Unix timestamp (in seconds)
String getTime = string.valueOf(Datetime.Now().getTime()/1000);
String requestInput = key + secret + getTime;
Blob requestBlob = Blob.valueOf(requestInput);
Blob hash = Crypto.generateDigest('MD5', requestBlob);
//Need to convert into hex to generate the equivalent of md5(string) method of PHP.
@402332509
402332509 / query.cls
Created May 11, 2017 06:01 — forked from cmbaughman/query.cls
Salesforce Apex Query with Wildcard
public static String getAllQuery(String query) {
String result = '';
String regex = '^select\\s+\\*\\s*(?:,\\s*[^\\s]+\\s*)*\\s+from\\s+([^\\s]+)(.*)$';
Matcher m = Pattern.compile(regex).matcher(query.toLowerCase());
if(m.matches()) {
String sObjectName = m.group(1);
Schema.SObjectType targetType = Schema.getGlobalDescribe().get(sObjectName);
Map<String, Schema.SObjectField> fieldMap = targetType.getDescribe().fields.getMap();
/**
* Title
*
* @author
* @version 1.0
* @description
* @uses
* @history
* yyyy-mm-dd :
*/
@402332509
402332509 / utils.cls
Last active May 12, 2017 10:22
salesforce开发工具累积
/**
* 工具类
* created by Harry 2016-12-08 21:22:18
*/
public without sharing class Utils {
//最小日期
public static final String MIN_DATE_TIME = '2000-01-01 00:00:00';
public static final String DATE_FORMAT_STR = 'yyyy-MM-dd';//默认日期文本格式
public static final String DATETIME_FORMAT_STR = 'yyyy-MM-dd HH:mm:ss';//默认时间文本格式
//记录类型缓存