Skip to content

Instantly share code, notes, and snippets.

View avisser's full-sized avatar

Andy Visser avisser

View GitHub Profile
// ==UserScript==
// @name Go away, lightning
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://*/lightning/page/home
// @match https://*/one/one.app
// @match https://*/lightning/setup/SetupOneHome/home
// @grant none
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
define(factory);
} else if (typeof exports === 'object') {
module.exports = factory();
} else {
root.ActionUtils = factory();
}
@avisser
avisser / clayton.md
Last active September 18, 2017 14:16

First crack at Clayton rules

  • disable "Require exception handling around DML statements"
    • can't set different policy for tests vs classes
  • disable "Require use of page messages in all pages"
    • This page doesn't present any messages to the user. Please include apex:pageMessages to display errors and messages in a user-friendly manner.

  • disable "Require compatibility with the Salesforce1 mobile app"
  • disable "Disallow use of dynamic SOQL"
    • fired for 'Select ' + fieldName not 'Where id = :id'
  • disable "Tag script is loading an external resource in a non-optimized way. Store the script in a static resource and use apex:includeScript to embed it in the page or component"
  • triggered for ``
public override int SaveChanges()
{
try
{
return base.SaveChanges();
}
catch (DbEntityValidationException ex)
{
// Retrieve the error messages as a list of strings.
var errorMessages = ex.EntityValidationErrors
int i=0;
foreach(var rule in Model.Rules) {
@Html.Partial("ValidationRuleRow", rule, new ViewDataDictionary {
TemplateInfo = new System.Web.Mvc.TemplateInfo { HtmlFieldPrefix = string.Format("Rules[{0}]", i) } })
i++;
}
// ==UserScript==
// @name New Userscript
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://mmcleadconnect.com/*
// @grant none
// ==/UserScript==
public class PutInGlobalAsaxCS {
protected void Application_PostAuthenticateRequest()
{
var user = HttpContext.Current.User as WindowsPrincipal;
if (user != null)
{
HttpContext.Current.User = new SpecPrincipal((WindowsIdentity) user.Identity);
}
}
}
public class GridColumnFactory<TModel> : IHideObjectMembers where TModel : class
{
}
public class MyFactory<T> : GridColumnFactory<T> where T : class
{
public MyFactory() : base(insert_params_here)
{
}
USE [DMP_Dev]
GO
DECLARE @RC int
DECLARE @io_CompanyId int
DECLARE @i_CompanyIdentifier varchar(36) = '1234567890'
DECLARE @i_CompanyStatusId smallint = 1
DECLARE @i_CompanyName varchar(100) = 'Funk Inc.'
DECLARE @i_WebSiteURL varchar(100)
DECLARE @i_CompanyRemovalReasonId smallint
CREATE VIEW [dbo].[vInteractionScranton]
AS
SELECT InteractionTable.InteractionScrantonID, InteractionTable.EntityID, InteractionTable.GrpID, dbo.Grp.Grp, InteractionTable.ContactName, InteractionTable.InteractionDate,
InteractionTable.TacticID, dbo.Tactic.Tactic, InteractionTable.ResponseTypeID, dbo.ResponseType.ResponseType, InteractionTable.CallDispositionID,
dbo.CallDisposition.CallDisposition, InteractionTable.Note, InteractionTable.EmailRead, InteractionTable.CampaignRemovalReasonID,
InteractionTable.NoInterestReasonID, InteractionTable.LeadTypeID, InteractionTable.PurchaseTimeFrame, InteractionTable.FollowUpActionID,
InteractionTable.SizeOfOpportunity, InteractionTable.DiscussionTopicID, dbo.DiscussionTopic.DiscussionTopic, InteractionTable.NoContactReasonID,
dbo.NoContactReason.NoContactReason, InteractionTable.SpokenToID, dbo.SpokenTo.SpokenTo, InteractionTable.NotVerifiedID, dbo.Not