Skip to content

Instantly share code, notes, and snippets.

Avatar

Chris Peterson capeterson

View GitHub Profile
View Custom-XP.macro
<!-- 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)
}}
View keybase.md

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
View SublimeAStyleFormatter.sublime-settings
{
// 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",
View Stuff.page
<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>
View map.cls
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 Jan 8, 2014
Apex List.addAll doesn't allow adding subclasses of the list's type properly.
View gist:8326438
List<SObject> l = new List<Sobject>();
l.addAll(new List<Contact>());
View MyControllerThing.cls
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;
}
View SublimeAstyleFormatter.sublime-settings
{
// 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",
View gist:5879152
Iterator<Schema.sObjectField> i = fields.iterator();
while(i.hasNext())
result += i.next() + i.hasNext() ? ',' :'';
View TestCumulative.cls
@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];