Skip to content

Instantly share code, notes, and snippets.

View kiran-machhewar's full-sized avatar

Kiran Machhewar kiran-machhewar

View GitHub Profile
@kiran-machhewar
kiran-machhewar / Util.cls
Created June 29, 2018 05:08
Get the DateTime from the Dates format which is GMT
/**
* @dateString : format should be like this 2018-06-10T12:34:15.29
*/
public DateTime parseDate(String dateString){
String dateStringJSON = ('{ "thedate": "'+dateString+'"}');
Map<String, DateTime> mockMap;
mockMap = (Map<String, DateTime>)JSON.deserialize(dateStringJSON, Map<String, DateTime>.class);
return mockMap.get('thedate');
}
public without sharing class LightningUtilController {
/**
* Method to update sobject record
* @param theSObject
* @return returns the created/updated sobject record
*/
@AuraEnabled
public static SObject upsertSObjectCtrl(SObject theSObject){
try{
/**
* @ApexClass : JSONObject
* @Author : Kiran Machhewar
* @Description : This class can be used to parse and work with json data in apex easy.
*/
public class JSONObject {
public String jsonString; //to hold the json string
private Object jsonObject; //to hold the deserialized json data
@kiran-machhewar
kiran-machhewar / ApexClass.cls
Last active June 26, 2018 22:59
Apex Documentation
/**
* @author Kiran Machhewar
* @date 26th June 2018
* @description Controller class for so and so page
*/
public class ApexClass{
}
@kiran-machhewar
kiran-machhewar / Example.cmp
Last active June 26, 2018 00:16
Lightning Component Template - This can be used as a boiler plate code for lightning component.
<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId,flexipage:availableForAllPageTypes"
controller="<CONTROLLER_NAME>" access="global">
<aura:attribute name="recordId" type="Id" />
<aura:attribute name="showSpinner" type="Boolean" default="false" />
<aura:handler name="init" action="{!c.doInit}" value="{!this}"/>
<!-- Spinner component -->
<aura:if isTrue="{!v.showSpinner}">
@kiran-machhewar
kiran-machhewar / AddingUsersToGroupOrQueue.cls
Created June 26, 2018 00:12
Working with Queue Members
List<Group> groups = [SELECT Id FROM Group WHERE Name in ('<QUEUE NAME>') AND Type = 'Queue' ];
List<User> usersToBeAdded = [SELECT Id FROM User WHERE Username in ('<user_email_id>')];
List<GroupMember> groupMembershipRecordsToBeCreated = new List<GroupMember>();
for(Group gp : groups){
for(User theUser : usersToBeAdded){
groupMembershipRecordsToBeCreated.add(new GroupMember(
GroupId = gp.Id,
UserOrGroupId = theUser.Id
));
}
<!-- LIGHTNING COMPONENT TEMPLATE BEGIN -->
<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId,flexipage:availableForAllPageTypes"
controller="<CONTROLLER_NAME>" access="global">
<aura:attribute name="recordId" type="Id" />
<aura:attribute name="showSpinner" type="Boolean" default="false" />
<aura:handler name="init" action="{!c.doInit}" value="{!this}"/>
FROM alpine
RUN apk update
RUN apk add bash
RUN apk add openssh
RUN apk add git
RUN apk add openjdk8
RUN apk add apache-ant --update-cache \
--repository http://dl-cdn.alpinelinux.org/alpine/edge/community/ \
--allow-untrusted
ENV ANT_HOME /usr/share/java/apache-ant
<apex:page >
<apex:includeLightning />
<div id="lightning" />
<button type="button" onclick="callLightningEvent();">Call Lightning Code From VF</button>
<script>
window.onload = function() {
$Lightning.use("c:LightningOutExampleApp", function() {
var comapp=$Lightning.createComponent("c:LightningOutExample",
{},
"lightning",
<aura:application access="GLOBAL" extends="ltng:outApp">
<aura:dependency resource="c:LightningOutExample"/>
</aura:application>