TL;DR: If you want to see me perform a spoken word poem about JavaScript in front of 1000 people (and on video), please ⭐ star this gist. If you're on mobile, you'll need to request desktop site.
function mapValues(obj, fn) { | |
return Object.keys(obj).reduce((result, key) => { | |
result[key] = fn(obj[key], key); | |
return result; | |
}, {}); | |
} | |
function pick(obj, fn) { | |
return Object.keys(obj).reduce((result, key) => { | |
if (fn(obj[key])) { |
from types import MethodType | |
import braintree | |
import jsonpickle | |
import json | |
def serialize(self): | |
""" Serialize a Braintree SuccessfulResult or ErrorResult object to a Python dict """ | |
return json.loads(jsonpickle.encode(self)) | |
braintree.ErrorResult.serialize = MethodType(serialize, None, braintree.ErrorResult) |