Skip to content

Instantly share code, notes, and snippets.

## Hangman
# Data
## Letters Guessed
## Number of Turns?
## Answer
## Dictionary
# Behaviors
## Greeting (and rules?)
@kingcons
kingcons / hangman.rb
Created January 13, 2016 02:48
January Crash Course
require "pry"
DICTIONARY = [
"cats", "dogs", "sleep", "pizza",
"bourbon", "music", "internet", "programming",
"cocktails", "parties", "anniversary", "other"
]
def greeting
puts "Welcome to Hangman!"
@kingcons
kingcons / dec_crash_course.rb
Created December 16, 2015 01:09
Thanks for Coming!
# require 'pry'
## Hangman
## Data
# collection of random words
# word, 4 to 12 letters
# limited number of turns
# collection of guesses
@kingcons
kingcons / projectile-hacks.el
Created December 1, 2015 22:01
Hacking yo text editor!
(defun tw/find-project-folders (dir)
(–map (file-relative-name it dir)
(-filter (lambda (subdir)
(–reduce-from (or acc (funcall it subdir)) nil
projectile-project-root-files-functions))
(-filter #‘file-directory-p (directory-files dir t “\<“)))))
(defun tw/open-project-by-name (start-dir &optional arg)
(let ((project-dir (projectile-completing-read “Open project: “
(tw/find-project-folders start-dir))))
@kingcons
kingcons / nov_crash_course.rb
Created November 18, 2015 00:54
November Crash Course
require 'pry'
## How does Hangman work?
## Data
# * guessed letters
# * answer - randomly selected word
# * turn count - 6
## Behaviors
language: ruby
rvm:
- 2.2.2
- 2.3.0
env:
- DB=postgresql
script:
- RAILS_ENV=test bundle exec rake test
before_script:
- RAILS_ENV=test bundle exec rake db:test:prepare
@kingcons
kingcons / cors.rb
Last active November 5, 2015 14:52
Whooooops!
# CORS (Cross Origin Resource Sharing)
=begin
Y'all I completely forgot to mention this yesterday!
We've got to enable this for *other* websites to be able to make requests to our website,
similar to disabling the CSRF forgery protection. With CSRF forgery disabled but CORS not *enabled*,
other HTTP clients (like Postman and HTTParty and curl) can make requests to the server but other
websites in the browser (like frontend-team.divshot.com) cannot.
=end
@kingcons
kingcons / sketch.md
Created October 14, 2015 20:51
Informal Homework Writeup

Today's homework

The weekend assignment will not be a group project, but today will continue from where you left off yesterday.

Pair up and share a computer, switching off at the keyboard after each commit. Talk through your thought process with your pair and ...

Write API wrappers to:

@kingcons
kingcons / install.md
Last active April 12, 2018 01:40
Install Party!

Computer Setup

Hey y'all. I want to be sure everyone is ready to roll, so here's are a few things I'd like for you to go ahead and install. Please ask if you have any trouble, or just are curious about why something works the way it does.

After each step, I'll leave a note saying how to check that it was installed properly. Please be sure to run these checks! The most common sorts of errors are commands not completing because your user lacks permission.

If that happens, feel free to flag me down and we'll get it fixed up quick! I'll assume things went smoothly unless I hear otherwise.

@kingcons
kingcons / crash_course.rb
Created September 16, 2015 00:05
Crash Course for September
# Gets for input, puts for output
# data to track:
# letters guessed, strings
# turn count, number
# answer, string
# actions in hangman:
# inform user of word length
# take turns until the game ends