Skip to content

Instantly share code, notes, and snippets.

View kpearson's full-sized avatar
💭
Building 💪

Kit Pearson kpearson

💭
Building 💪
View GitHub Profile
# Pig Latin
# =========
#
# Implement a program that translates from English to Pig Latin.
#
# Pig Latin is a made-up children's language that's intended to be
# confusing. It obeys a few simple rules (below), but when it's spoken
# quickly it's really difficult for non-children (and non-native speakers)
# to understand.
#
@kpearson
kpearson / Doctors at 3201 Wilshire.md
Created July 27, 2018 18:03
3201 Wilshire Blvd, Santa Monica, CA 90403

Doctors at 3201 Wilshire

3201 Wilshire Blvd, Santa Monica, CA 90403

  • Adams, Andrea P., M.A., M.F.T.
  • Adams, Parker, MA., M.F.T.
  • Alter, Micki, MA., M.F.T.
  • AMI Network, Inc.
  • Anders, Elizabeth, Ph.D. -------------------------------------
@kpearson
kpearson / README.md
Last active March 29, 2018 20:57
pig

Pig Latin

Implement a program that translates from English to Pig Latin.

Pig Latin is a made-up children's language that's intended to be confusing. It obeys a few simple rules (below), but when it's spoken quickly it's really difficult for non-children (and non-native speakers) to understand.

  • Rule 1: If a word begins with a vowel sound, add an "ay" sound to
@kpearson
kpearson / LICENSE
Created February 5, 2018 17:43 — forked from sinisterchipmunk/LICENSE
tar, gzip, and untar files using ruby in memory without tempfiles
Copyright (C) 2011 by Colin MacKenzie IV
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in

Pry Cheat Sheet

Command Line

  • pry -r ./config/app_init_file.rb - load your app into a pry session (look at the file loaded by config.ru)
  • pry -r ./config/environment.rb - load your rails into a pry session

Debugger

#!/usr/bin/env ruby
# To make this file executable:
# 1. Change the file permissions to allow execution.
# `chmod 755 gh_repo_stats.rb`
# 2. Rename the file to remove the .rb.
# `mv githubarchive.rb gh_repo_stats`
# 3. Last, the file needs to be in the load path. To do this soft link from it
# from its current location to `use/local/bin/`.
# `ln -s $PWD/gh_repo_stats /usr/local/bin/`
data:text/html,%20<style>html,body%7Bmargin:%200;%20padding:%200;%7D</style><textarea%20style="font-size:%201.5em;%20line-height:%201.5em;%20background:%20%23000;%20color:%20%233a3;%20width:%20100%25;%20height:%20100%25;%20border:%20none;%20outline:%20none;%20margin:%200;%20padding:%2090px;"%20autofocus%20placeholder="wake%20up%20Neo..."%20/>

How to run the test file

  1. First move the two files in to the same directory on to your system.

  2. Then install the gems 'minitest' and 'purdytest' with:

$ gem install 'minitest'
$ gem install 'purdytest'

Integration - Create an Order

Creating an order in the Yoshirt system requires a few separate calls.

  1. Create a new guest User for the customer.
  2. Create a Cart.
  3. Add a Product, Design to the Cart.
  4. Add a ShippingAddress.
  5. Create Order.
@kpearson
kpearson / http request header dump | Rails Controller code.md
Created March 9, 2016 19:59
Place in a controller action to have the server print to screen the contents of the http request headers.

Place in a controller action to have the server print to screen the contents of the http request headers.

logger.warn "*** BEGIN RAW REQUEST HEADERS ***"
self.request.env.each do |header|
  logger.warn "HEADER KEY: #{header[0]}"
  logger.warn "HEADER VAL: #{header[1]}"
end
logger.warn "*** END RAW REQUEST HEADERS ***"