Skip to content

Instantly share code, notes, and snippets.

View abhinavguptas's full-sized avatar

Abhinav Gupta abhinavguptas

View GitHub Profile
@xixiaofinland
xixiaofinland / sfdx-cheatsheet.sh
Last active March 28, 2024 18:54
Salesforce SFDX Cheat Sheet
# Proudly supplied by Salesforce Way Site: https://salesforceway.com
# This cheatsheet contains the most often used SFDX commands for beginners to get a jumpstart.
# Hint. it is highly recommended to use `-h` to check the usage of any SFDX commands and corresponding parameters.
# For instance, use `sfdx force:auth:web:login -h` to checke what `-d` `-a` parameters do
# List down all supported dx commands:
sfdx force:doc:commands:list
# Check current DebHub and Scratch Org status
sfdx force:org:list
<apex:page controller="jTableAccountsController">
<link href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/redmond/jquery-ui.css" rel="stylesheet" type="text/css" />
<link href="{!URLFOR($Resource.jtable, 'jtable/themes/jqueryui/jtable_jqueryui.min.css')}" rel="stylesheet" type="text/css" />
<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"/>
<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"/>
<apex:includeScript value="{!URLFOR($Resource.jtable, 'jtable/jquery.jtable.min.js')}"/>
@avaliani
avaliani / geocoder-service.js
Last active February 3, 2022 16:13 — forked from benmj/geocoder-service.js
This is a fork of @benmj 's Angular JS Geocoder service. It fixes the following bugs (1) rootscope apply missing, (2) executeNext() not being called if the response type is 'zero results', 'request denied' or 'invalid result', and (3) it simplifies the query pause logic (no increasing pause times and tasks are rejected if we are still over quota…
/*
* An AngularJS Service for intelligently geocoding addresses using Google's API. Makes use of
* localStorage (via the ngStorage package) to avoid unnecessary trips to the server. Queries
* Google's API synchronously to avoid `google.maps.GeocoderStatus.OVER_QUERY_LIMIT`.
*
* @author: benmj
* @author: amir.valiani
*
* Original source: https://gist.github.com/benmj/6380466
*/
@tehnrd
tehnrd / gist:9242970
Last active June 12, 2017 20:00
Check to see if Visualforce page is inside Salesforce1
//Determin if this is SF1 app
public static Boolean isSF1(){
if(!Utils.checkNullOrBlank(ApexPages.currentPage().getParameters().get('sfdcIFrameHost')) ||
!Utils.checkNullOrBlank(ApexPages.currentPage().getParameters().get('sfdcIFrameOrigin')) ||
ApexPages.currentPage().getParameters().get('isdtp') == 'p1' ||
(ApexPages.currentPage().getParameters().get('retURL') != null && ApexPages.currentPage().getParameters().get('retURL').contains('projectone') )
){
return true;
}else{
return false;
@keirbowden
keirbowden / QRCode.page
Last active November 11, 2019 14:46
Salesforce1 QR Code Reader
<apex:page >
<script type="text/javascript"
src="//ajax.aspnetcdn.com/ajax/jQuery/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="{!URLFOR($Resource.QRCode, 'jsqrcode-master/src/grid.js')}"></script>
<script type="text/javascript" src="{!URLFOR($Resource.QRCode, 'jsqrcode-master/src/version.js')}"></script>
<script type="text/javascript" src="{!URLFOR($Resource.QRCode, 'jsqrcode-master/src/detector.js')}"></script>
<script type="text/javascript" src="{!URLFOR($Resource.QRCode, 'jsqrcode-master/src/formatinf.js')}"></script>
<script type="text/javascript" src="{!URLFOR($Resource.QRCode, 'jsqrcode-master/src/errorlevel.js')}"></script>
<script type="text/javascript" src="{!URLFOR($Resource.QRCode, 'jsqrcode-master/src/bitmat.js')}"></script>
@abhinavguptas
abhinavguptas / Blogs-To-Follow-OPML.xml
Last active March 21, 2024 08:56
Best Salesforce Developer Blogs to Follow
<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
<head>
<title>Salesforce Blogs to follow</title>
</head>
<body>
<outline text="salesforce" title="salesforce">
<outline type="rss" text="Sundog" title="Sundog" xmlUrl="http://feeds2.feedburner.com/Sunblog" htmlUrl="http://www.sundoginteractive.com/sunblog/"/>
<outline type="rss" text="Secure Salesforce" title="Secure Salesforce" xmlUrl="http://simplyforce.blogspot.com/feeds/posts/default" htmlUrl="http://simplyforce.blogspot.com/"/>
<outline type="rss" text="Andrew Boettcher - Salesforce Technologist" title="Andrew Boettcher - Salesforce Technologist" xmlUrl="http://techman97.wordpress.com/feed/" htmlUrl="http://techman97.wordpress.com"/>
@amphro
amphro / RunNSTests.js
Last active December 30, 2015 23:49
Run an org's namespace tests from the developer console. Just open the browser's Javascript console and past the code in. Update: Will now use an unsupported servlet instead of the Tooling API to prevent compilation if the SymbolTables are not in the cache. To use the Tooling API, change line 115/116.
function runNamespacedTest(namespace) {
var thisOrgsNs = SfdcDevConsole.hasNamespace() ? SfdcDevConsole.namespace : '';
var ns = namespace || thisOrgsNs;
function log(msg) {
if (console && console.log) console.log(msg);
}
function showErrorMessage() {
Ext.Msg.alert('Running namespaced tests failed', 'Please look at the javascript console for more information.');
@joshbirk
joshbirk / strategy.js
Created February 1, 2012 22:33
ForceDotCom Strategy for Passport
/**
* Module dependencies.
*/
var querystring = require('querystring'),
util = require('util'),
OAuth2Strategy = require('passport-oauth').OAuth2Strategy;
function Strategy(options, verify) {
options = options || {};
@joshbirk
joshbirk / KennelTest.java
Created January 23, 2012 22:59
Using PhoneGap to get and upload Images in Visualforce
public with sharing class KennelTest {
public Dog__c exampleDog {get; set;}
public Attachment dogImage {get; set;}
public String getImageBase64() {
if(dogImage.Body != null) {
return EncodingUtil.base64Encode(dogImage.Body);
} else {
return '';
}
@abhinavguptas
abhinavguptas / AWS.java
Created September 24, 2011 03:05
Fixture for Apex HTTP Callout Testing [Note: file name kept .java instead of .cls for syntax highlighting :)]
/*
Copyright (c) 2011 tgerm.com
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.