Skip to content

Instantly share code, notes, and snippets.

View chingsley's full-sized avatar

Kingsley Eneja chingsley

View GitHub Profile
@chingsley
chingsley / vampr.js
Created January 23, 2022 13:35
Lighthouse Vampr-challenge: Tree data structure and tree traversal
class Vampire {
constructor(name, yearConverted) {
this.name = name;
this.yearConverted = yearConverted;
this.offspring = [];
this.creator = null;
}
/** Simple tree methods **/
module GameConstants
MAX_LIVES = 2
end
class Game
include GameConstants
attr_reader :title, :player1, :player2, :current_player
attr_accessor :game_over
def initialize(title, player1, player2)
require 'active_support/all'
@candidates = [
{
id: 5,
years_of_experience: 4,
github_points: 293,
languages: ['C', 'Ruby', 'Python', 'Clojure'],
date_applied: 5.days.ago.to_date,
age: 26
@chingsley
chingsley / benchmark_with_block.rb
Created January 7, 2022 21:33
benchmarking with blocks in ruby
def benchmark(&block)
start_time = Time.now
block.call
end_time = Time.now
return end_time - start_time
end
long_string = "apple" * 100000000