Skip to content

Instantly share code, notes, and snippets.

View sjurgis's full-sized avatar

Jurgis Šalna sjurgis

  • Auckland, New Zealand
View GitHub Profile
@sjurgis
sjurgis / salesforce-calendar-view.md
Last active February 5, 2018 08:37
FullCalendar calendar view implementation in Salesforce.com

This is an adaptation of Cody Sechelski's Create a Calendar View in Salesforce.com.

The main problem with his implementation was that it wasn't handling more than 2000 records. This was due to a Apex workaround, as it is reserves start and end variables, Cody made a repeat table and parsed that into JavaScript object. My solution creates JSON string in Apex and then uses string function to replace all startString and endString instances. A more sensible solution would involve recreating the object in JavaScript or simply editing the FullCalendar library to look for different variable names.

I have also simplified the code a bit so you can start working towards your personal implementation. As this is using JavaScript remoting, I hope this gives you a framework to work towards more advanced features like editing or optimizing request sizes (executing a request on next month load).

The page

<apex:page showHeader="fals
Array.prototype.slice.call( document.querySelectorAll('a[title^="Delete"') ).map(function (t) { t.click() })
@sjurgis
sjurgis / gist:c48ca6ee67f0883731a81eb57ebdb6d2
Created December 5, 2016 20:59
BitBat plugin to ping default gateway
#!/bin/bash
# <bitbar.title>ping</bitbar.title>
# <bitbar.version>v1.1</bitbar.version>
# <bitbar.author>Trung Đinh Quang, Grant Sherrick and Kent Karlsson</bitbar.author>
# <bitbar.author.github>thealmightygrant</bitbar.author.github>
# <bitbar.desc>Sends pings to a range of sites to determine network latency</bitbar.desc>
# <bitbar.image>http://i.imgur.com/lk3iGat.png?1</bitbar.image>
# <bitbar.dependencies>ping</bitbar.dependencies>
@sjurgis
sjurgis / lts-unit-test.MD
Created April 18, 2018 07:20
How to do actual unit testing in Lightning Testing Service

Expose helper via an public aura:method function in your abstract component's testHelperController.js:

getHelper: function(component, event, helper) {
 if ( $T ) {
  return helper;
 } else {
  throw new Error('API is only supported in test context');
 }
}
@sjurgis
sjurgis / gist:0ad7c9702f58c4beb3bb3d3bd381d37d
Created May 8, 2018 08:53
Service components using lax
<aura:component controller="FooService">
<c:lax context="{!this}" />
<aura:method name="getByAppName">
<aura:attribute name="AppName" type="string" />
</aura:method>
</aura:component>
({
getByAppName : function(component, event, helper) {
return component.lax.enqueue('c.GetByAppName', event.getParam('arguments'))
}
({
afterRender: function (component, helper) {
this.superAfterRender();
var targetEl = component.find("main").getElement();
var preventPullToRefreshCheckbox = true;
var preventOverscrollGlowCheckbox = false;
var preventScrollCheckbox = false;
var maybePreventPullToRefresh = false;
var lastTouchY = 0;
#!/bin/bash
# <bitbar.title>ping</bitbar.title>
# <bitbar.version>v1.1</bitbar.version>
# <bitbar.author>Trung Đinh Quang, Grant Sherrick and Kent Karlsson</bitbar.author>
# <bitbar.author.github>thealmightygrant</bitbar.author.github>
# <bitbar.desc>Sends pings to a range of sites to determine network latency</bitbar.desc>
# <bitbar.image>http://i.imgur.com/lk3iGat.png?1</bitbar.image>
# <bitbar.dependencies>ping</bitbar.dependencies>
@sjurgis
sjurgis / create-org.sh
Last active July 28, 2021 01:27
sfdx github actions example
#!/bin/bash
set -e
set -o pipefail
CLIENT_ID=$1
rm -f ./server.key
cat > ./server.key
sfdx auth:jwt:grant --setdefaultusername --clientid "$CLIENT_ID" --jwtkeyfile ./server.key --username [email protected] -a HubOrg
sfdx force:org:create -v HubOrg -s -f ./config/project-scratch-def.json -d 1 -w 10 -a ciorg --noancestors
name: misc
on: [push]
jobs:
setup:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install NPM modules
uses: bahmutov/npm-install@v1
name: sfdx test flow
on: [push]
jobs:
setup:
runs-on: ubuntu-latest
container: salesforce/salesforcedx
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install NPM modules