Skip to content

Instantly share code, notes, and snippets.

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 / gist:bda51f6fc8b22b5df301
Last active December 31, 2025 23:33
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

@vrinek
vrinek / post.md
Last active August 29, 2015 14:13
Ruby 2.2 - Warning: circular argument reference

Ruby 2.2.0 now warns against a circular argument reference. It is pretty simple to demonstrate and pretty difficult to explain so I'll just present some code snippets.

The first example shadows a function (which I have encountered in one of the open-source projects I'm involved with):

def foo
  42
end

def bar(foo = foo)
irb(main):065:0> a = "雷"
"雷"
irb(main):066:0> b = a.unpack("C*").pack("C*")
"\xE9\x9B\xB7"
irb(main):067:0> a == b
false
irb(main):068:0> a.bytes == b.bytes
true
irb(main):069:0> a == b.unpack("U*").pack("U*")
true
@import url("../rust.css");
body {
max-width:none;
}
@media only screen {
#toc {
position: absolute;
left: 0px;
@vrinek
vrinek / cleanup.md
Created December 12, 2015 13:02
Monday morning cleanup scripts

Docker

docker ps -a | grep 'weeks ago' | awk '{print $1}' | xargs docker rm
docker images | grep '^<none>' | awk '{print $3}' | xargs docker rmi

Rails

const fetch = require('node-fetch');
const FormData = require('form-data');
const nock = require('../');
const formData = new FormData();
formData.append('test', 'true');
nock('http://localhost')
.post('/api/test')
.reply(function(uri, requestBody) {
const configureMockStore = require('redux-mock-store').default;
const thunk = require('redux-thunk').default;
const nock = require('../');
const expect = require('expect'); // You can use any testing library
const fetch = require('isomorphic-fetch');
function fetchTodosRequest() {
return {
type: 'FETCH_TODOS_REQUEST'
}
var http = require('http');
var countdown = 10;
function makeRequest(iteration) {
var t = Date.now();
http.request({
host: 'www.google.com',
path: '/'
}, function(response){
const nock = require('../.');
const test = require('tap').test;
const request = require('request');
test('reqheaders ignored #748 - test matching', t => {
nock('http://www.example.com', {
reqheaders: {
'authorization': 'Bearer TOKEN'
}
})