Skip to content

Instantly share code, notes, and snippets.

View Oblongmana's full-sized avatar
🐕

James Hill Oblongmana

🐕
View GitHub Profile
@pcon
pcon / CaseEdit_ControllerExtension.java
Last active October 7, 2015 00:37
Dynamic dependent picklists
global with sharing class CaseEdit_ControllerExtension {
private final Id recordId;
private final Case record;
private final ApexPages.StandardController controller;
public Case_ControllerExtension(ApexPages.StandardController stdController) {
this.controller = stdController;
this.recordId = this.controller.getId();
this.record = [
select Product__c,
@naholyr
naholyr / function-argnames.js
Created February 19, 2012 18:30
JS Introspection: extract function parameter names
Function.prototype.argNames = function () {
// Extract function string representation: hopefully we can count on it ?
var s = this.toString();
// The cool thing is: this can only be a syntactically valid function declaration
s = s // "function name (a, b, c) { body }"
.substring( // "a, b, c"
s.indexOf('(')+1, // ----------------^
s.indexOf(')') // ------^
);