Skip to content

Instantly share code, notes, and snippets.

View lukaszhanusik's full-sized avatar
✨👁️🖤👁️✨ ⚡️

Lukasz Hanusik lukaszhanusik

✨👁️🖤👁️✨ ⚡️
View GitHub Profile
@lukaszhanusik
lukaszhanusik / Address.cls
Created December 14, 2020 08:11 — forked from afawcett/Address.cls
Apex Address compound type, based on that provided in Spring'14 for Salesforce API, http://www.salesforce.com/us/developer/docs/api/Content/compound_fields_address.htm
public class Address
{
// Internally used to determine if valueOf method should read the state and country picker fields
private static Boolean stateAndCountryPickersEnabled = false;
static
{
// Are State and Country pickers enabled in this org?
Map<String, Schema.SObjectField> accountFields = Account.sObjectType.getDescribe().fields.getMap();
stateAndCountryPickersEnabled = accountFields.containsKey('BillingStateCode');
@lukaszhanusik
lukaszhanusik / eventCreation.txt
Created June 24, 2021 17:59 — forked from brianbier/eventCreation.txt
All possible Options for creating an event, Since It doesn't work for regular lightning components
window.open('/lightning/o/Event/new');
var urlEvent = $A.get("e.force:navigateToURL");
urlEvent.setParams({
"url": "/lightning/o/Event/new"
});
urlEvent.fire();
var createRecordEvent = $A.get("e.force:createRecord");
createRecordEvent.setParams({
@lukaszhanusik
lukaszhanusik / CurrencyUpdater
Created July 1, 2021 14:47 — forked from goravseth/CurrencyUpdater
Pulls current rates and updates CurrencyType records in SFDC
public class CurrencyUpdater {
list <CurrencyType> ctl = new list<CurrencyType>([SELECT Id,IsoCode,ConversionRate FROM CurrencyType WHERE IsActive = TRUE AND IsCorporate = FALSE]);
map <string, CurrencyType> ctMap = new map<String, CurrencyType>();
public CurrencyUpdater () {
for (CurrencyType ct : ctl){
ctMap.put(ct.IsoCode,ct);
}
}
@lukaszhanusik
lukaszhanusik / findDupes
Created July 1, 2021 14:48 — forked from goravseth/findDupes
invocable apex to find duplicate contacts using the new findDuplicates apex stuff
public class Flow_FindDupes {
//https://developer.salesforce.com/forums/?id=906F0000000AzDeIAK
@InvocableMethod(label='Get Dupes' description='Returns something')
public static List<Contact> getDuplicateContacts(List<Contact> contacts) {
system.debug('contacts size = ' + contacts.size());
list<sObject> dasContacts = new list<sobject>();
dasContacts.addall((List<sObject>)(contacts));
list<Contact> duplicateContacts = new list<Contact>();
@lukaszhanusik
lukaszhanusik / README.md
Created September 1, 2021 07:43 — forked from nolanlawson/README.md
Repro Chrome style recalc issue

repro-recalc

Minimal repro for the Chrome style recalc issue.

@lukaszhanusik
lukaszhanusik / group-objects-by-property.md
Created September 22, 2021 05:17 — forked from mikaello/group-objects-by-property.md
Group Array of JavaScript Objects by Key or Property Value

Group array of JavaScript objects by keys

This fork of JamieMason's implementation changes the key parameter to be an array of keys instead of just a single key. This makes it possible to group by multiple properties instead of just one.

Implementation

const groupBy = keys => array =>
  array.reduce((objectsByKeyValue, obj) => {
    const value = keys.map(key => obj[key]).join('-');
@lukaszhanusik
lukaszhanusik / localstorage.js
Created September 23, 2021 00:53 — forked from vishnu-prasad-r/localstorage.js
Javascript snippet to use HTML5 localStorage easily. Supports storing any kind of data. Handles commonly occuring exceptions like localStorage quota being exceeded and browser not supporting localStorage. .
/*Javascript snippet to use HTML5 localStorage easily.
Properly handles situation like 'localStorage not being supported by the browser' and excedding localSorage quota.
Supports storing any kind of data */
/*key should be String, value can be any Javascript object */
function writeToLocalStorage(key,value)
{
if(typeof(Storage) == 'undefined')
{
'use strict'
class JSONMap extends Map {
constructor (value) {
let mapArgs = []
if (value) {
for (let k of Object.keys(value)) {
mapArgs.push([ k, value[k] ])
}
}
/**
* Created by brettbarlow on 2/24/18.
*/
// LightningComponentInVisualforce
window._lightningComponentInVisualforce = (function() {
return {
LightningComponent : function(type, attributes, locator) {
this.type = type;
this.attributes = attributes;
@lukaszhanusik
lukaszhanusik / example.md
Created April 15, 2022 11:49 — forked from gghughunishvili/example.md
Postman pm.sendRequest example

To send a request via the sandbox, you can use pm.sendRequest.

pm.test("Status code is 200", function () {
    pm.sendRequest('https://postman-echo.com/get', function (err, res) {
        pm.expect(err).to.not.be.ok;
        pm.expect(res).to.have.property('code', 200);
        pm.expect(res).to.have.property('status', 'OK');
    });
});