Skip to content

Instantly share code, notes, and snippets.

View afiune's full-sized avatar
🏠
Working from home

Salim Afiune Maya afiune

🏠
Working from home
View GitHub Profile
@juliandunn
juliandunn / monkeypatch-nil.rb
Created June 11, 2014 19:44
Monkeypatching NilClass to clarify what the heck is meant by "NoMethodError: undefined method `[]' for nil:NilClass"
class NilClass
def []
raise "What the hell, dawg, you can't access an element of nil"
end
def [](a)
raise "What the hell, dawg, you can't access element #{a} of nil"
end
end
@christopher-hopper
christopher-hopper / vm-resize-hard-disk.md
Last active August 15, 2024 15:16
Resize a Hard Disk for a Virtual Machine provisioned using Vagrant from a Linux base box to run using VirutalBox.

Resize a Hard Disk for a Virtual Machine

Our Virtual Machines are provisioned using Vagrant from a Linux base box to run using VirutalBox. If the Hard Disk space runs out and you cannot remove files to free-up space, you can resize the Hard Disk using some VirtualBox and Linux commands.

Some assumptions

The following steps assume you've got a set-up like mine, where:

@hallettj
hallettj / global-variables-are-bad.js
Created February 14, 2009 21:15
How and why to avoid global variables in JavaScript
// It is important to declare your variables.
(function() {
var foo = 'Hello, world!';
print(foo); //=> Hello, world!
})();
// Because if you don't, the become global variables.
(function() {