Skip to content

Instantly share code, notes, and snippets.

@noeticpenguin
noeticpenguin / RestClient.java
Created October 21, 2013 13:05
A basic Rest Client for Salesforce's Apex
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;
@noeticpenguin
noeticpenguin / CommunityDebuggerCtrl.cls
Last active April 21, 2021 20:43
Community Debugger controller
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');
@noeticpenguin
noeticpenguin / CommunityDebugger.page
Created February 5, 2015 01:56
CommunityDebugger visualforce page
<apex:page controller="CommunityDebuggerCtrl" action="{!fetchFailingPage}" showHeader="false" sidebar="false" >
<apex:outputText id="failingPageResponse" escape="false" value="{!failingPageResponse}" />
</apex:page>
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);
angular.module('myApp').config(['$httpProvider', function($httpProvider) {
delete $httpProvider.defaults.headers.common['X-Requested-With'];
});
@noeticpenguin
noeticpenguin / pesudocode.html
Created January 8, 2014 20:28
bootstrapping an ng app after manual remoting calls. Jason, Essentially, you want to do this:
<!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
// 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 December 13, 2013 18:01
example filter with trust as html for angular 1.2+
@noeticpenguin
noeticpenguin / moduleAndBind.js
Created December 2, 2013 23:31
directive template
angular./**
* app Module
*
* skeleton app module for skeleton directive.
*/
var app = angular.module('app', [])
.directive('ng', ['', function(){
// Runs during compile
return {
name: 'modelAndBind',
[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)