Skip to content

Instantly share code, notes, and snippets.

@markgarg
markgarg / permutation_generator.py
Created June 25, 2017 21:23
Permutation generator - first attempt
"""
Given an integer 'n', create a generator that will return a new permutation
of the integers between 1 and n, until all the permutations have been
exhausted.
Ex: input: 3
output: 123, 132, 321, 231, 312, 213
"""
@markgarg
markgarg / DummyInstantiableCheck
Created February 18, 2015 14:23
Sample code to check whether Dynamic Apex works with params. The input param is printed in the method => Dynamic Apex works with params
// Get the Type corresponding to the class name
Type t = Type.forName('DummyTypeInstantiableOne');
// Instantiate the type.
// The type of the instantiated object
// is the interface.
DummyTypeInstantiableOne dtiOne = (DummyTypeInstantiableOne) t.newInstance();
// Call the methods that have a custom implementation
System.debug('Output for the method :' + dtiOne.processRule('one'));
public with sharing class BeerPaginatorJSRemoting {
public BeerPaginatorJSRemoting() {
// Do nothing
}
@RemoteAction
public static List<Beer__c> getBeerList(){
List<Beer__c> beerList = [SELECT Id, Name, Tags__c, Alcohol__c, Brewery__r.Name FROM Beer__c LIMIT 1000];
return beerList;
}