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 Dyanmic.java
public static List<Object> getFieldValues(List<SObject> data, String fieldName){
List<Object> results = new List<Object>();
for(SObject record:data){
results.add(record.get(fieldName));
}
return results;
}
View Id.cls
Id someId = [SELECT id FROM Contact LIMIT 1].Id;
String ruinedCase = ((String)someId).toLowerCase();
Id fixedCase = Id.valueOf(ruinedCase);
System.assertEquals(
String.valueOf(someId).subString(0,15),
String.valueOf(fixedCase).substring(0,15)
); //fails, for me: System.AssertException: Assertion Failed: Expected: 003i000002O2aZG, Actual: 003i000002o2azg
View gist:721491e539606ba728d3
Account a = [SELECT id, name, description FROM Account LIMIT 1];
a.description = 'This code with person accounts on is like playing russion roulete';
update a; //DMLException if you got a person account, works otherwise
View name.cls
public class OhGodBees extends Exception{}
//fails: OhGodBees: Classes extending Exception must have a name ending in 'Exception'
View serve.py
#!/usr/bin/env python
import os, sys, re
from os import curdir, sep
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
class MyHandler(BaseHTTPRequestHandler):
def do_GET(self):
try:
View gist:11231360
Account a1 = new Account(name = 'woop');
Account a2 = new Account(name = 'woop');
System.debug( a1 == a2 ); //true
System.debug( a1 === a2 ); //false
View gist:9731104
final String MY_NAMESPACE_PREFIX = 'ns__';
String cleanedJSON = JSON.serialize(subject);
cleanedJSON = cleanedJSON.replaceAll('"'+MY_NAMESPACE_PREFIX+'([a-zA-Z0-9_-]+":)', '"$1');
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",
You can’t perform that action at this time.