Skip to content

Instantly share code, notes, and snippets.

View Vegann's full-sized avatar

Damian Kaczmarczyk Vegann

View GitHub Profile
@carlosramireziii
carlosramireziii / attached_validator.rb
Last active April 10, 2024 11:11
A validator and RSpec matcher for requiring an attachment using Active Storage
class AttachedValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
record.errors.add(attribute, :attached, options) unless value.attached?
end
end
@Ely-S
Ely-S / Deep extend.js
Created December 2, 2012 22:55
Fastest way to Deep Clone/Extend an object in javascript
//benchmark available here
// clone is the object to recursively copy the attributes of obj to overwriting as necessary.
function x(clone, obj) {
for(var i in obj)
clone[i] = (typeof obj[i] == "object") ? x(obj[i].constructor(), obj[i]) : obj[i];
return clone;
}
@chitchcock
chitchcock / 20111011_SteveYeggeGooglePlatformRant.md
Created October 12, 2011 15:53
Stevey's Google Platforms Rant

Stevey's Google Platforms Rant

I was at Amazon for about six and a half years, and now I've been at Google for that long. One thing that struck me immediately about the two companies -- an impression that has been reinforced almost daily -- is that Amazon does everything wrong, and Google does everything right. Sure, it's a sweeping generalization, but a surprisingly accurate one. It's pretty crazy. There are probably a hundred or even two hundred different ways you can compare the two companies, and Google is superior in all but three of them, if I recall correctly. I actually did a spreadsheet at one point but Legal wouldn't let me show it to anyone, even though recruiting loved it.

I mean, just to give you a very brief taste: Amazon's recruiting process is fundamentally flawed by having teams hire for themselves, so their hiring bar is incredibly inconsistent across teams, despite various efforts they've made to level it out. And their operations are a mess; they don't real