Skip to content

Instantly share code, notes, and snippets.

View mmcdaris's full-sized avatar

Morgan Mikel McDaris mmcdaris

View GitHub Profile
@mmcdaris
mmcdaris / hello.markdown
Last active February 22, 2019 23:27
images

Here are images

@mmcdaris
mmcdaris / keybase.md
Created December 12, 2017 21:34
keybase

Keybase proof

I hereby claim:

  • I am mmcdaris on github.
  • I am mmcdaris (https://keybase.io/mmcdaris) on keybase.
  • I have a public key whose fingerprint is 939D 3FB2 7CA7 FED8 98A8 7235 C7DA 5314 3B95 7C90

To claim this, I am signing this object:

@mmcdaris
mmcdaris / error.json
Last active November 2, 2017 22:13
Example Airbrake error for posting
{
"errors": [
{
"type": "AirbrakeTestError",
"message": "I am an example error",
"backtrace": [
{
"file": "app/models/avocado.rb",
"line": 10,
"function": "make_guacamole",
@mmcdaris
mmcdaris / anagrams.rb
Last active April 20, 2017 01:02
lil anagram finder
# Anagram: a word, phrase, or name formed by rearranging the letters of another.
# Usage: Anagrams.new.find("anemic")
# ["anemic", "iceman", "cinema"]
class Anagrams
def initialize
@words = {}
File.open("/usr/share/dict/words") do |file|
file.each do |line|
@words[line.strip] = true
end
@mmcdaris
mmcdaris / R2G_to_local.md
Created March 21, 2017 22:09
Replicate from REDISTOGO to your local machine

example RTG_URL: redis://username:secretpasswordfromtheurl@lab.redistogo.com:9555/

Step 1: Start a local redis-server and redis-cli

$ redis-server
#in a new tab run:
$ redis-cli
@mmcdaris
mmcdaris / dump_to_file.rb
Created February 1, 2017 01:57
Dump to a file! Move some objs
# Fancy obj you want to share
hash = {
a: 1234,
b: %W(this that the other one man yo yoy oyoyoyo),
c: "Magic Pants Found!"
}
# dump and write to file
File.open("marsha_marsha_marsha", 'wb') { |f| f.write(Marshal.dump(hash)) }
@mmcdaris
mmcdaris / rspec_backtrace_exclusion.md
Last active January 15, 2021 15:02
Exclude gem lines from RSpec backtrace

Purpose

Excludes gem related lines in your rspec backtraces.
Useful when you only want to see backtrace lines from your app and spec code.

example .rspec file

note: path to helper file is relative

# File: .rspec
--require ./tmp/rspec_helper.rb
@mmcdaris
mmcdaris / example_game.md
Last active May 12, 2016 03:35
kitty ping pong!

example game 🐱 🎾 🐯 thanks @thompiler

@mmcdaris
mmcdaris / do-doo-duu-doo.rb
Created April 1, 2016 17:08
silly sonic pi tune! :D
# Welcome to Sonic Pi v2.9
wait = 0.25
a = wait * 0.5
r = a
d = a * 0.5
s = d
live_loop :flibble do
use_synth :tri
@mmcdaris
mmcdaris / tender_kb_exporter.rb
Last active February 4, 2016 21:38
Export all your tender docs as markdown
# Exports tender knowledge base as markdown files in the current directory
# Usage
# TenderKnowledgeBase.new(app_name, tender_token).markdown_export
#
class TenderKnowledgeBase
attr_accessor :api, :docs, :page
def initialize(tender_app, tender_token)
@api = RestClient::Resource.new("https://api.tenderapp.com/#{tender_app}",
headers: {