Skip to content

Instantly share code, notes, and snippets.

🇺🇸
In SF

Arthur Rio arthurio

🇺🇸
In SF
  • Minerva Project, Inc
  • San Francisco
Block or report user

Report or block arthurio

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@arthurio
arthurio / Extends
Created Apr 6, 2015
Python function to merge 2 dicts, similar to what angular does
View Extends
'''
Extends a dict object A with the properties of a dict object B.
@param a: dict object
@param b: dict object
'''
def extends(a, b):
for key in b:
if key in a:
if isinstance(a[key], dict) and isinstance(b[key], dict):
a[key] = extends(a[key], b[key])
View .vimrc.after
color wombat
hi ColorColumn ctermbg=lightgrey guibg=#474747
" Cursor shape
hi Cursor guibg=orange guifg=white
set autoindent
set smartindent
set tabstop=4
@arthurio
arthurio / sample.json
Created Jul 17, 2014
Sample data for Purchase webhook
View sample.json
{
"timestamp": 1405631393.186916,
"user": {
"uid": "1234",
"first_name": "John",
"last_name": "Doe",
"email": "john.doe@example.com"
},
"transaction": {
"id": "123-345-678"
@arthurio
arthurio / sign.py
Last active Aug 29, 2015
Webhook Signature Example
View sign.py
import hmac
import hashlib
import simplejson
from time import time
data = {
'timestamp': time(),
'user': {
'uid': 1234
}
@arthurio
arthurio / Bronto referral
Last active Aug 29, 2015
Javascript snippet to call the Bronto referral API
View Bronto referral
PT.api.call('/bronto/referral', {
method: 'post',
data: {
message: 'Example of message',
emails: ['example1@punchtab.com', 'example2@punchtab.com']
// OR emails: 'example1@punchtab.com,example2@punchtab.com'
},
success: function (response) {
console.log('OK');
},
@arthurio
arthurio / build_dict.py
Created Mar 11, 2014
Build a dict in python - 2.6 syntax vs. 2.7
View build_dict.py
data = ['a', 'b', 'c']
# Python v2.7
my_dict = {key: i for i, key in enumerate(data)}
# Python v2.6
my_dict = dict((key, i) for i, key in enumerate(data))
You can’t perform that action at this time.