Skip to content

Instantly share code, notes, and snippets.

View dummied's full-sized avatar

Chris Vannoy dummied

View GitHub Profile
💩 = Class.new do
def self.alltime_poops
@poops ||= []
end
def self.stats
puts "You've pooped #{alltime_poops.count{ |poo| poo.timestamp.strftime("%A, %b %d") == Time.now.strftime("%A, %b %d") }} times today."
end
@dummied
dummied / assignment.md
Created March 1, 2017 13:59
Jacques' Revenge

Description

Hi. I'm Jacques, a frontend developer working with you on the Notemeister 5000 application.

I have the frontend all laid to use your API. Here's what I'm expecting (note, these values are examples, they should be the values of the actual note):

GET /api/notes

puts "Testing if gist is working given the S3 outage"
@dummied
dummied / fizz_buzz.rb
Created February 21, 2017 13:46
Teensy FizzBuzz test-driven example
# Print the numbers 1 to 100
# For multiples of 3, print "Fizz" instead of the number
# For multiples of 5, print "Buzz" instead of the number
# For multiples of 3 and 5, print "FizzBuzz" instead of the number
$(document).ready(function(){
initialize_giphy()
})
Array.prototype.each_slice = function (size, callback){
for (var i = 0, l = this.length; i < l; i += size){
callback.call(this, this.slice(i, i + size))
}
}
@dummied
dummied / band_leaders.rb
Created October 5, 2015 15:33
In-class example for Week 1, Day 1
artist = ARGV[0].dup if ARGV[0]
second_variable = ARGV[1].dup if ARGV[1]
if artist
artist.downcase!
end
if second_variable
second_variable = second_variable.to_i
end
@dummied
dummied / interview_questions.md
Last active May 8, 2017 20:23
Contributed by the indy.rb community
  1. Sum an array of numbers
  2. Implement your own version of Enumerable#collect
  3. Write a function that finds all the duplicate words in an abritrary amount of text
  4. Do FizzBuzz: "Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”."
  5. What's the difference between a class and a module?
  6. Implement HashWithIndifferentAccess
  7. Show two ways to render a list of Users’ names given class User > ActiveRecord::Base
  8. Why is CSRF important?
  9. Implement a job that finds all Users who are overdue and create a file containing that information (Bonus question, this)
  10. Sketch out database/model schema for a blog w/ comments, authors, tags
class Post
attr_accessor :id, :title, :body, :summary, :author, :created_at
def initialize(hash)
@id = hash[:id]
@title = hash[:title]
@body = hash[:body]
@summary = hash[:summary]
@author = hash[:author]
@created_at = hash[:created_at] || Time.now
@dummied
dummied / enumerables.rb
Last active August 29, 2015 14:24
Week 2, Day 1 morning in-class code
require 'csv'
class Enumerables
def self.enumerable_to_test
CSV.foreach('planet_express_logs.csv', headers: true)
end
def self.hard_earth_records
our_earths = []
self.enumerable_to_test.each do |row|
if row["Destination"] == "Earth"
@dummied
dummied / robot_generator.rb
Last active August 29, 2015 14:24
Week 1, Day 3 Homework Review
# Require the `faker` gem (install via `gem install faker`)
require 'faker'
# Define a Robot class: A robot has a name
class Robot
attr_accessor :name,
:height