Skip to content

Instantly share code, notes, and snippets.

@vrinek
vrinek / gist:bda51f6fc8b22b5df301
Last active February 10, 2024 20:21
Blizzard Software Engineering Reading

Blizzard Software Engineering Reading

by Jay Baxter (circa 2009)

Associate developer

"This list is for people who want to become Associate Software Engineers at Blizzard. An associate should have skills at the level indicated by these books. Note that this is almost completely focused on C++ programming. This list is incomplete. I need a book on how to become a professional. I've listed several books that give examples of professional behavior, but not one on the actual training."

Programming: Principles and Practice Using C++

by Bjarne Stroustrup

require 'active_support/hash_with_indifferent_access'
require 'minitest/autorun'
def sum(a: 0, b: 0)
a + b
end
class BugTest < MiniTest::Unit::TestCase
def setup
@normal_hash = {a: 18, b: 24} # just a hash
@vrinek
vrinek / nested_timers.rb
Last active August 29, 2015 13:57
Dead-simple nested timers for Ruby
class MyTimerClass
attr_reader :timers
def initialize
@timers = {}
@parent_timer = nil
end
def clock!(name, &block)
@timers[name] ||= 0
$ git status
# On branch my-branch
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: db/schema.rb
#
no changes added to commit (use "git add" and/or "git commit -a")
$ git diff
@vrinek
vrinek / gist:5676786
Created May 30, 2013 09:34
Rename a method in Ruby
class Animal
def speak
puts "..."
end
end
class Cat < Animal
def speak
puts "Mew..."
end
-- Prints the variable (even a table) in detail. It is very useful for tables
-- where print() is more or less useless.
function inspect(variable, indentation)
local inspected = "" -- this will be printed at the end
local inner_indentation = indentation and indentation + 1 or 0 -- for nested tables
local tabs = "" -- also for nested tables
for i=1,inner_indentation do
tabs = tabs .. "\t"
end
if @user.try(:can_edit_post?)
# do something
end
class StaticsController < ActionController::Base
def render_404
if real_404?
send_detailed_disaster_mail(request)
end
respond_to do |format|
format.json do
render json: "", status: 404
end
# -*- encoding : utf-8 -*-
require "spec_helper"
require "set"
# Reads requests from test/fixtures/logs/requests.log and builds examples that
# test if the requests are routable.
#
# The syntax it understands is (same as `haproxy.log`):
# {www.skroutz.gr} "POST /shops/add_review/984?some=other"
#
@vrinek
vrinek / gist:2773707
Created May 23, 2012 07:29
Add encoding line to all spec files
enc = '# -*- encoding : utf-8 -*-'
`git ls-files -- spec | xargs head -1 | grep -v encoding`.
split("\n\n").
reject{|l| l !~ /\n/}.
map{|l| l.split("\n").first}.
map{|f| f[/^==> (.*) <==$/, 1]}.
each{|f|
system "echo '#{enc}' > tempfile && cat #{f} >> tempfile && mv tempfile #{f}"
}