Skip to content

Instantly share code, notes, and snippets.

View msrivastav13's full-sized avatar
🎯
Focusing

Mohith Shrivastava msrivastav13

🎯
Focusing
View GitHub Profile
@isTest
private class TestCreatedDateSetter{
static testmethod void createAccountTest(){
Account acc = new Account();
acc.Name = 'Test';
insert acc;
DateTime myDateTime = DateTime.newInstance(1997, 1, 31, 7, 8, 16);
Test.setCreatedDate(acc.Id, myDateTime );
Test.startTest();
@msrivastav13
msrivastav13 / iframeSF1Scroll.js
Last active May 15, 2017 16:44
Add the scrolling behavior for iframe embedded in visualforce inside SF1 app
<script type="text/javascript">
(function() {
try {
var a = navigator.userAgent;
if ((a.indexOf('Salesforce') != -1) && (a.indexOf('iPhone') != -1 || a.indexOf('iPad') != -1) && (a.indexOf('OS/8') != -1 || a.indexOf('OS 8') != -1 || a.indexOf('OS/9') != -1 || a.indexOf('OS 9') != -1) && (a.indexOf('Safari') == -1)) {
var s = document.createElement('style');
if (a.indexOf('OS/8') != -1 || a.indexOf('OS 8') != -1) {
s.innerHTML = "html,html body{overflow: auto;-webkit-overflow-scrolling:touch;}body{position:absolute;left:0;right:0;top:0;bottom:0;}";
} else if (a.indexOf('OS/9') != -1 || a.indexOf('OS 9') != -1) {
s.innerHTML = "html,html body{overflow: auto;-webkit-overflow-scrolling:auto;}body{position:absolute;left:0;right:0;top:0;bottom:0;}";
@msrivastav13
msrivastav13 / unfreezeSF1Keys.js
Last active December 6, 2015 20:04
Workaround for Ipad key freezing issues on SF1 app
<script type="text/javascript">
window.onkeydown=function(){ // Workaround for known issue with SFDC(https://success.salesforce.com/issues_view?id=a1p30000000T5l1AAC)
window.focus();
}
</script>
<apex:page standardStylesheets="false" showHeader="false" sidebar="false">
<html xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<head>
<apex:stylesheet value="{!URLFOR($Resource.SLDS0102, 'assets/styles/salesforce-lightning-design-system-vf.css')}" />
<apex:includeLightning />
</head>
<body>
<div class="slds">
<div class="slds-grid slds-wrap">
<!--Action Buttons -->
@msrivastav13
msrivastav13 / SimpleTestApp.app
Created November 5, 2015 23:06
SimpleTestApp.app
<aura:application access="GLOBAL" extends="ltng:outApp">
<aura:dependency resource="c:SimpleTestCmp" />
</aura:application>
<aura:component >
<aura:attribute name="richtextData" type="String"></aura:attribute>
<ui:inputRichText value="{!v.richtextData}" aura:id="inputRT" label="Rich Text Demo"/>
</aura:component>
public class SLDSValidatordemocontroller{
public SLDSValidatordemocontroller(ApexPages.StandardController controller) {
}
@RemoteAction
public static Id createAccount(String name,String fax){
Account acc = new Account();
acc.Name = name;
acc.Fax = fax;
@msrivastav13
msrivastav13 / SLDSValidatorDEMO.page
Last active November 2, 2015 03:24
SLDSValidatorDEMO
<apex:page showHeader="false" sidebar="false" standardController="Account" standardStylesheets="false" extensions="SLDSValidatordemocontroller" docType="html-5.0" id="thePage" applyHtmlTag="false" applyBodyTag="false">
<html xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<head>
<apex:stylesheet value="{!URLFOR($Resource.SLDS0102, 'assets/styles/salesforce-lightning-design-system-vf.css')}" />
<apex:includeScript value="//code.jquery.com/jquery-2.1.4.min.js" />
<apex:includeScript value="{!URLFOR($Resource.SLDSValidator)}" />
</head>
<body>
<div class="slds">
@msrivastav13
msrivastav13 / MortgageComponent.cmp
Created October 25, 2015 19:20
MortgageComponent
<aura:component implements="forceCommunity:availableForAllPageTypes">
<c:MortgageForm/>
<br/><br/>
<c:MortgageResponse/>
</aura:component>
@msrivastav13
msrivastav13 / SLDS_Validator.js
Last active November 2, 2015 02:52
SLDS Validator plugin
var validatorSLDSplugin = (function(j$) {
return {
validate: function() {
var error = false;
var allInputs = j$(":input");
j$(allInputs).each(function() {
var isrequired = j$(this).attr("data-required");
if (typeof isrequired != 'undefined') {
if (typeof j$(this).attr("id") != 'undefined') {
if (isrequired === 'true') {