Skip to content

Instantly share code, notes, and snippets.

@nickpresta
nickpresta / gist:e61dec7fbca5cbf843dd
Created April 30, 2015 15:12
Lodash string methods vs underscore.string vs other languages
// Lodash
_.padRight('', 5, 'x'); // === ''
// underscore.string
s.rpad('', 5, 'x'); // === 'xxxxx'
// Python
'{:x<5}'.format('') # == 'xxxxx'
// Ruby
@nickpresta
nickpresta / slownet.go
Last active August 29, 2015 14:16
Create a "delayed" JavaScript file
// Usage: Send GET request to /<seconds> to wait <seconds> seconds
package main
import (
"net/http"
"strconv"
"time"
)
func main() {
@nickpresta
nickpresta / gist:34812e791e3d89498dee
Last active August 29, 2015 14:15
Sentry JavaScript
Validating the source map shows encoding errors on
https://github.com/lodash/lodash/blob/d2dc918a619d7207d214fd95fc1858d0578ab86e/lodash.js#L200
See validation errors here: http://i.imgur.com/U335kIQ.png
This leaves me with Sentry traces that look like: http://i.imgur.com/Qb12rL0.png

Keybase proof

I hereby claim:

  • I am nickpresta on github.
  • I am nickpresta (https://keybase.io/nickpresta) on keybase.
  • I have a public key whose fingerprint is 7BF0 5213 6E82 1BD3 17F2 DA29 64DC A9EE CB45 B39A

To claim this, I am signing this object:

[
{
"amount": 333540,
"business": "https:\/\/payments-api.tide.wave-dev.com\/business-profile\/b3af09b4-34d5-40d0-978d-0754d31489b4",
"delivery_date": null,
"fees": 1213,
"id": "64c8b2e5-0269-46cc-ab59-f707b706ae02",
"status": "failed",
"submissions": [
{
let g:netrw_list_hide='\.o,\.obj,*~,\.pyc,' "stuff to ignore when tab completing
let g:netrw_list_hide.='\.env,'
let g:netrw_list_hide.='\.env[0-9].,'
let g:netrw_list_hide.='\.git,'
let g:netrw_list_hide.='\.gitkeep,'
let g:netrw_list_hide.='\.vagrant,'
let g:netrw_list_hide.='\.tmp,'
let g:netrw_list_hide.='\.coverage$,'
let g:netrw_list_hide.='\.DS_Store,'
let g:netrw_list_hide.='__pycache__,'
I wanna be
the very best
like no one ever was
I'll farm engrams
and open chests
and abuse random drops
But when I find
strong enemies
I can't SUROS Regime
@nickpresta
nickpresta / gist:4296c2e75cad392f351f
Created August 26, 2014 18:31
Parsing "dict" arguments for Invoke
def parse_extra_args(extra_args):
"""Expects `extra_args` to be in the format of: key=val,key2=val,key3=val"""
if extra_args is None:
return {}
parts = extra_args.split(',')
return {k: v for k, v in (i.split('=') for i in parts)}
@task
def foo(extra_args=None):

Keybase proof

I hereby claim:

  • I am nickpresta on github.
  • I am nickpresta (https://keybase.io/nickpresta) on keybase.
  • I have a public key whose fingerprint is A248 2595 433F F5B7 0684 8BBF 0E4E 5A56 5EFD FFD6

To claim this, I am signing this object:

import pika
import sys
import logging
logging.basicConfig(level=logging.INFO)
def sales_handler(ch, method, properties, body):
print " [x] %r:%r" % (method.routing_key, body,)
def refund_handler(ch, method, properties, body):
print " [x] %r:%r" % (method.routing_key, body,)
def chargeback_handler(ch, method, properties, body):