Skip to content

Instantly share code, notes, and snippets.

View msrivastav13's full-sized avatar
🎯
Focusing

Mohith Shrivastava msrivastav13

🎯
Focusing
View GitHub Profile
({
toggleClass: function(component,componentId,className) {
var modal = component.find(componentId);
$A.util.removeClass(modal,className+'hide');
$A.util.addClass(modal,className+'open');
},
toggleClassInverse: function(component,componentId,className) {
var modal = component.find(componentId);
$A.util.addClass(modal,className+'hide');
<aura:event type="APPLICATION">
<aura:attribute name="userId" type="String"/>
</aura:event>
<aura:application access="GLOBAL" extends="ltng:outApp">
<aura:dependency resource="c:sampleComponent" />
</aura:application>
<apex:page showHeader="true" sidebar="true">
<apex:includeLightning />
<div id="lightning"> hello World VF!! </div>
<script>
$Lightning.use("c:sampleApp", function() {
$Lightning.createComponent("c:sampleComponent", {},
"lightning",
function(cmp) {
var myExternalEvent;
myExternalEvent = $A.get("e.c:sampleEvent");
<aura:component>
<div> Hello World !!!! </div>
<aura:registerEvent name="myevent" type="c:myEvent" />
<ui:button label="fireEvent" press="{!c.fireevent}" />
</aura:component>
<apex:page showHeader="false" sidebar="false">
<apex:includeLightning />
<div id="lightning"> Hello world VF ..!!! </div>
<script>
$Lightning.use("c:myEventApp", function() {
$Lightning.createComponent("c:myComponent", {}, "lightning", function(){
$A.eventService.addHandler({ "event": "c:myEvent", "handler" : visualForceFunction});
});
@msrivastav13
msrivastav13 / SearchController.apex
Created March 16, 2016 14:06
Apex class for searching Topic and Users
public with sharing class SearchController {
@AuraEnabled
public static list<UserWrapper> searchPeople(String searchString){
list<UserWrapper> lstusers = new list<UserWrapper>();
Id communityId = Network.getNetworkId();
Id networkId = [Select Name, Id From Network where Id =:;//Fetch the community Id of the Current User
searchString = '%' + searchString + '%';
//Get User records as per search keyterm
map<id,User> mapIdByUser = new map<id,User>([Select Id,
@msrivastav13
msrivastav13 / ContactSupport.cmp
Last active March 24, 2016 21:14
Lightning Component For Contact Support Button
<aura:component implements="forceCommunity:availableForAllPageTypes">
<aura:attribute name="supportURL" type="string" default="/s/contactsupport"/>
<ui:button aura:id="button" buttonTitle="Contact Support" label="Contact Support" press="{!c.navigate}" class="uiButton forceCommunityAskCommunity"/>
</aura:component>
@msrivastav13
msrivastav13 / app.js
Created March 29, 2016 17:09
A app.js file for the node process
ar nforce = require('nforce');
var express = require('express');
var port = process.env.PORT || 3000;
var org = nforce.createConnection({
clientId: '3MVG9uudbyLbNPZMk0vYn7ICarLW4qV5bLdL.KqYws.i1.oN99y14Skth6utXg0nwCuPpSMtr9lB7HIOx6M65',
clientSecret: '6326007125179395206',
redirectUri: 'https://protected-fortress-46904.herokuapp.com/oauth/_callback',
apiVersion: 'v34.0', // optional, defaults to current salesforce API version
environment: 'production', // optional, salesforce 'sandbox' or 'production', production default
@msrivastav13
msrivastav13 / home.ejs
Created March 29, 2016 17:19
Home page for our app with lightning Out
<!DOCTYPE html>
<html lang="en">
<head>
<% include ../partials/ldOut %>
</head>
<body class="slds">
<header>
</header>
<main>
<div >