Skip to content

Instantly share code, notes, and snippets.

View capeterson's full-sized avatar

Chris Peterson capeterson

View GitHub Profile
@capeterson
capeterson / Custom-XP.macro
Last active July 4, 2020 02:31
Roll20 Macros
<!-- Grant XP either to the selected single character, or the party's current session pool -->
/w gm &{template:default} {{title=Grant ?{How Much|50} XP}} {{description=
[Selected Char XP](!xp challenge ?{How Much} 1 @{selected|token_id}
/desc @{selected|token_name} gained ?{How Much} xp)
[Party XP](!xp challenge ?{How Much} 1
/desc The party gained ?{How Much} session xp)
}}

Keybase proof

I hereby claim: * I am capeterson on github. * I am ca_peterson (https://keybase.io/ca_peterson) on keybase. * I have a public key ASAAnJfvwOIoTjEgmUKFqbgqOnJYoOaSH8MD239zfmtyuwo To claim this, I am signing this object:

{   "body": {     "key": {       "eldest_kid": "0120009c97efc0e2284e3120994285a9b82a3a7258a0e6921fc303db7f737e6b72bb0a",       "host": "keybase.io",       "kid": "0120009c97efc0e2284e3120994285a9b82a3a7258a0e6921fc303db7f737e6b72bb0a",       "uid": "a7d75452ee6df63668e9753a0259e619",       "username": "ca_peterson"     },     "merkle_root": {       "ctime": 1582993040,       "hash": "54edd33011844a2f71b930d1cdb978f882093b88435b0c6c66053e5278727b8c011e32fdfb2ee2e855a223d68ad517127e0c008eb96ba3117cbba0a893b34596",       "hash_meta": "0c9785432d2d05f3a11b807b4860892553d4938293ce36db356ad1967924618f",       "seqno": 14831790     },     "service": {       "entropy": "d+1A+FSZueoAvEld2WkIW0Po",       "name": "github",       "username": "capeterson"     },     "typ
{
// NOTE: You should always edit options in user file, not this file.
// Auto format on file save
"autoformat_on_save": false,
// Please visit http://astyle.sourceforge.net/astyle.html for more information
"options_default": {
// Default bracket style
// Can be either "allman", "ansi", "bsd", "break", "java", "attach", "kr", "k&r",
<apex:page controller="Thingy">
This blank canvas with our controller applied lets us invoke the remoting methods from the dev console via:
<ul>
<li><code>Thingy.regularLimits(function(response){console.log('Regular limits are:',response);});</code></li>
<li><code>Thingy.readOnlyLimits(function(response){console.log('Regular limits are:',response);});</code></li>
</ul>
</apex:page>
new Map<String,Object>{
'isBooleanType' => true,
'integerType' => 42,
'strings' => 'are stringy',
'this is where it gets tripy' => new Map<String,Object>{
'down the rabbit hole' => true,
'through the looking glass' => new Map<String,Object>{
'isThisEnoughToGetThePointAcross' => true
}
},
@capeterson
capeterson / gist:8326438
Created January 8, 2014 23:08
Apex List.addAll doesn't allow adding subclasses of the list's type properly.
List<SObject> l = new List<Sobject>();
l.addAll(new List<Contact>());
public with sharing class MyControllerThing{
@RemoteAction
public static MyWrapperThing getWrapper(){
MyWrapperThing result = new MyWrapperThing();
result.isSomething = true;
result.name = 'my wrapper obj';
result.version = 7;
return result;
}
{
// NOTE: You should always edit options in user file, not this file.
// Auto format on file save
"autoformat_on_save": false,
// Please visit http://astyle.sourceforge.net/astyle.html for more information
"options_default": {
// Default bracket style
// Can be either "allman", "ansi", "bsd", "break", "java", "attach", "kr", "k&r",
Iterator<Schema.sObjectField> i = fields.iterator();
while(i.hasNext())
result += i.next() + i.hasNext() ? ',' :'';
@isTest
private class TestCumulative{
@isTest
private static void cumulativeTest(){
List<test_obj__c> objs = [select id from test_obj__c];
for(integer i = 0; i < 99; i++){
insert new test_obj__c();
}
System.debug(LoggingLevel.Error,'Finished the loop. About to die.');
objs = [select id from test_obj__c];