Skip to content

Instantly share code, notes, and snippets.

@mmcdaris
mmcdaris / airbrake-curl.md
Last active November 6, 2020 13:06
Airbrake example error with curl!

Want to curl an Airbrake test exception?

If you want to curl an error to the Airbrake error capturing service you have come to the right place! This is based off the API doc for create notice. There are more details there ;) https://airbrake.io/docs/#create-notice-v3

Just curl the json with the following command:

curl -X POST -H "Content-Type: application/json" -d @error.json "https://airbrake.io/api/v3/projects/PROJECT_ID/notices?key=PROJECT_KEY"
@mmcdaris
mmcdaris / airbrake-django.md
Last active August 29, 2015 14:27
airbarke-django example

Install airbrake-django from github using pip

pip install git+https://github.com/airbrake/airbrake-django.git

Add airbrake to your settings.py

Make a section in your settings.py for the airbrake settings for your project:

@mmcdaris
mmcdaris / README.md
Last active August 29, 2015 14:27
airbrake-js filter: Don't send project root in backtrace lines

I was playing with the airbrake-js requirejs example and trying to filter out project_root from backtrace lines

Here is my airbrake-js addFilter for filtering out project root

airbrake.addFilter(function(notice) {
  var projectRoot = 'PROJECT_ROOT';
  for (i = 0; i < notice.errors.length; i++) {
    for(j = 0; j < notice.errors[i].backtrace.length; j++) {
      notice.errors[i].backtrace[j].file = notice.errors[i].backtrace[j].file.replace(projectRoot, '')
 };
@mmcdaris
mmcdaris / meditation.md
Last active August 29, 2015 14:23
Meditation kit

How meditation can reshape our brains

IMAGE ALT TEXT

How to meditate

IMAGE ALT TEXT

@mmcdaris
mmcdaris / dynamic-redis-geo.md
Created February 27, 2015 06:30
dynamic-redis + redis-geo setup
@mmcdaris
mmcdaris / post-commit
Last active March 24, 2016 16:23
rescuetime daily habits post-commit hook
#!/bin/sh
# more info on set -e https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html#The-Set-Builtin
set -e
## CREDIT
# I made this from: https://github.com/RescueTime/git-commits-to-rescuetime-daily-highlights/blob/master/post-commit.sample
# Thanks @robby1066 it's been fun fine tuning this
## INSTALLATION
# add this to any project's .git/hooks/ dir as post-commit
# chmod -x .git/hooks/post-commit
@mmcdaris
mmcdaris / scoreboard.sh
Created February 5, 2015 17:58
Simple Redis ScoreBoard with a sorted set
127.0.0.1:6379> ZADD FEB-SCORES 0 "JP"
(integer) 1
127.0.0.1:6379> ZADD FEB-SCORES 0 "MORGAN"
(integer) 1
127.0.0.1:6379> ZINCRBY FEB-SCORES 10 "MORGAN"
"10"
127.0.0.1:6379> ZINCRBY FEB-SCORES 20 "JP"
"20"
127.0.0.1:6379> ZREVRANGE FEB-SCORES 0 -1 WITHSCORES
1) "JP"
@mmcdaris
mmcdaris / cat_map.go
Last active August 29, 2015 14:11
Map Literals Continued
package main
import "fmt"
type Cat struct {
size, snack string
}
var cats = map[string]Cat{
"bello": {"med-small", "Bonito Flakes"},
@mmcdaris
mmcdaris / .vimrc
Last active August 29, 2015 14:07
my vimrc with
" ===== vim-go - github.com/fatih/vim-go =====
" goimports
let g:gofmt_command ="goimports"
" gofmt on save
autocmd FileType go autocmd BufWritePre <buffer> Fmt
" useful maps
au FileType go nmap <leader>r <Plug>(go-run)