Skip to content

Instantly share code, notes, and snippets.

Kevin Poorman noeticpenguin

View GitHub Profile
@noeticpenguin
noeticpenguin / RestClient.java
Created Oct 21, 2013
A basic Rest Client for Salesforce's Apex
View RestClient.java
Public with sharing virtual class RestClient {
Public class RestClientException extends Exception {}
/*
* class variable creation - DO NOT EDIT
*/
Public Map<String,String> headers;
Public String url;
Public String method;
View How to call the code coverage query via execute anonymous
toolingSoapSForceCom.SessionHeader_element sessionEl = new toolingSoapSForceCom.SessionHeader_element();
sessionEl.sessionId = UserInfo.getSessionId();
toolingSoapSForceCom.SforceService service = new toolingSoapSForceCom.SforceService();
service.SessionHeader = sessionEl;
//service.endpoint_x = //Adjust this to your endpoint, if needed...
toolingSoapSForceCom.ApexCodeCoverageAggregateQueryResult queryResult = service.queryApexCodeCoverageAggregate('Select NumLinesCovered From ApexCodeCoverageAggregate');
System.debug(queryResult);
@noeticpenguin
noeticpenguin / CommunityDebugger.page
Created Feb 5, 2015
CommunityDebugger visualforce page
View CommunityDebugger.page
<apex:page controller="CommunityDebuggerCtrl" action="{!fetchFailingPage}" showHeader="false" sidebar="false" >
<apex:outputText id="failingPageResponse" escape="false" value="{!failingPageResponse}" />
</apex:page>
@noeticpenguin
noeticpenguin / CommunityDebuggerCtrl.cls
Last active Sep 28, 2016
Community Debugger controller
View CommunityDebuggerCtrl.cls
public with sharing class CommunityDebuggerCtrl {
public String failingPageResponse { get; set; }
String toLoad {get; private set;}
Map<String, String> params {get; private set;}
String queryString = '?';
public CommunityDebuggerCtrl() {
params = ApexPages.currentPage().getParameters();
toLoad = (String) params.get('page');
View gist:8427615
angular.module('myApp').config(['$httpProvider', function($httpProvider) {
delete $httpProvider.defaults.headers.common['X-Requested-With'];
});
@noeticpenguin
noeticpenguin / pesudocode.html
Created Jan 8, 2014
bootstrapping an ng app after manual remoting calls. Jason, Essentially, you want to do this:
View pesudocode.html
<!doctype html>
<html xmlns:ng="http://angularjs.org">
<body>
Hello {{'World'}}!
<script src="http://code.angularjs.org/angular.js"></script>
<script>
angular.element(document).ready(function() {
RemoteJSCall.then(function(results){
//manipulate results if needed.
//do whatever with results to get app ready
View reducers.js
// Write a general-purpose reducer that excludes items based on a predicate
function excludeReducer(predicate) {
return function(newArray, item) {
return predicate(item) ? newArray : newArray.concat(item);
}
}
function excludeIdReducer(id) {
return excludeReducer(function(item) {
@noeticpenguin
noeticpenguin / autolink.js
Created Dec 13, 2013
example filter with trust as html for angular 1.2+
View autolink.js
View moduleAndBind.js
angular./**
* app Module
*
* skeleton app module for skeleton directive.
*/
var app = angular.module('app', [])
.directive('ng', ['', function(){
// Runs during compile
return {
name: 'modelAndBind',
View 2.js
[Error] Error: 'undefined' is not an object (evaluating 'self.scope.$form.$data[$attrs.eName] = newVal')
https://c.cs13.visual.force.com/resource/1384277518000/ccpp/ccpp/js/xeditable.js:302:33
$digest@https://c.cs13.visual.force.com/resource/1384277518000/ccpp/ccpp/js/angular.js:10569:29
$apply@https://c.cs13.visual.force.com/resource/1384277518000/ccpp/ccpp/js/angular.js:10802:31
done@https://c.cs13.visual.force.com/resource/1384277518000/ccpp/ccpp/js/angular.js:6937:51
completeRequest@https://c.cs13.visual.force.com/resource/1384277518000/ccpp/ccpp/js/angular.js:7102:15
onreadystatechange@https://c.cs13.visual.force.com/resource/1384277518000/ccpp/ccpp/js/angular.js:7058:26
(anonymous function) (angular.js, line 8296)
(anonymous function) (angular.js, line 5967)
$digest (angular.js, line 10581)
You can’t perform that action at this time.