Skip to content

Instantly share code, notes, and snippets.

@yourFriendWes
yourFriendWes / snippet.jsx
Created January 10, 2017 03:28
radio button snippet
import React, { PropTypes } from 'react';
var Application = React.createClass({
getInitialState: function () {
return {
selectedOption: 'option1',
selectedOptionTwo: 'option5'
};
},
{
"pets": {
"dog": {
"id": "515",
"name": "Rusty",
"breed": "ChocolateLabrador"
}
"dog": {
"id": "516",
"name": "Lulu",
@yourFriendWes
yourFriendWes / OregonTrailier.md
Last active December 21, 2015 03:38
Oregon Trail Part Deux Hackathon Proposal

Oregon Trail Part Deux

Yes, I recognize that this is already a computer game. But I previously turned it into a card game when I was bored, and now wanna turn it back into a computer game using the card game rules, because meta.

Why we should choose this for the hackathon

This game has it all!

It involves ;

  • ROLE PLAYING
  • DISEASE
@yourFriendWes
yourFriendWes / flight_movies.rb
Last active December 11, 2015 17:33 — forked from Hamled/flight_movies.rb
Charles's version
def find_movies(flight_length, movie_lengths)
movie_complements = Set.new
movie_lengths.each do |movie_length|
# We have a good movie pair if this length is the complement of a previous movie's length
return true if movie_complements.include? movie_length
# Otherwise, track the complement of this movie's length for checking against succeeding movie lengths
movie_complements << (flight_length - movie_length)
end
@yourFriendWes
yourFriendWes / flight_movies.rb
Created December 10, 2015 19:30
Ada In-Movie Flight Finder
def flight_movies?(movie_lengths, flight_minutes)
!!movie_lengths.uniq.combination(2).detect { |a, b| a + b == flight_minutes }
end
#testing in irb
movie_times = [90, 120, 30, 25, 60, 225, 75, 10, 105, 15]
#testing that method won't return true when there is one movie that matches flight time, but not two
> flight_movies?(movie_times, 60)
@yourFriendWes
yourFriendWes / game_outline.rb
Created October 5, 2015 23:41
charles's game outline example
#lets say we were writing a game- here's how we would write out the outline for ourselves
class Game
# game logic
#print welcome
#print the board
#take input from player 1
#validate input from player 1
#make player 1's move
#check if player 1 has won the game
#if player 1 has won - print closing message and exit
@yourFriendWes
yourFriendWes / planet_class.rb
Last active October 2, 2015 14:20
solar system wave 2
class Planet
attr_reader :name, :region, :sun, :index, :terraformed, :population, :diameter, :moons
def initialize(info_hash)
@name = info_hash[:name]
@region = info_hash[:region]
@sun = info_hash[:sun]
@index = info_hash[:index]
@terraformed = info_hash[:terraformed]
@population = info_hash[:population]
@yourFriendWes
yourFriendWes / school.rb
Last active September 30, 2015 05:13 — forked from lgranger/student.rb
Lauren's versions of the student files I messed up
class School
attr_reader :name, :address, :students
def initialize(name, address)
@name = name
@address = address
@students = []
end
@yourFriendWes
yourFriendWes / solar_system.rb
Last active September 29, 2015 00:53
Solar System challenge, using the Firefly/Serenity universe
class Planet
attr_reader :name, :region, :sun, :index, :terraformed, :population, :diameter
def initialize(name, region, sun, index, terraformed, population, diameter)
@name = name
@region = region
@sun = sun
@index = index
@terraformed = terraformed
@population = population
@yourFriendWes
yourFriendWes / ltp_8_3_array.rb
Last active September 28, 2015 02:38
My answers to exercise 8.3 in Chris Pine's "Learn to Program"
words = []
puts "Type in some words. Press enter after each word. When you're done, type enter twice."
reply = gets.chomp.downcase
while reply.downcase != ''
words.push(reply)
reply = gets.chomp.downcase
end
puts "Great job! Here's a list of all of your words in alphabetical order:"
puts words.sort