Skip to content

Instantly share code, notes, and snippets.

View omarismail's full-sized avatar

Omar Ismail omarismail

  • HashiCorp
View GitHub Profile
function rails_pg() {
rails new $1 -T --database=postgresql &&
cd $1 &&
echo $1 > .ruby-gemset &&
echo 2.0 > .ruby-version &&
echo /config/database.yml >> .gitignore &&
cp config/database.yml config/database.example.yml &&
add_rails_gems &&
function rails_pg() {
rails new $1 -T --database=postgresql &&
cd $1 &&
echo $1 > .ruby-gemset &&
echo 2.0 > .ruby-version &&
echo /config/database.yml >> .gitignore &&
cp config/database.yml config/database.example.yml &&
add_rails_gems &&

Capybara

save_and_open_page

Matchers

have_button(locator)
@omarismail
omarismail / search.js
Last active August 29, 2015 14:10 — forked from poteto/search.js
// utils/computed/search.js
import Ember from 'ember';
var computed = Ember.computed;
export default function search(dependentKey, propertyKey, searchQueryKey, returnEmptyArray) {
returnEmptyArray = (typeof returnEmptyArray === "undefined") ? false : returnEmptyArray;
return computed("" + dependentKey + ".@each." + propertyKey, searchQueryKey, function() {
var items, query;
if (returnEmptyArray && !this.get(searchQueryKey)) {
return Ember.A([]);
@omarismail
omarismail / gist:032871359191198f35ac
Last active August 29, 2015 14:14
Traversing down a notebook tree
getTreeData: function() {
var rootNotebooks = this.get('rootNodes');
var data = [];
rootNotebooks.forEach(function(notebook) {
var currentNotebook = notebook;
var dataObj = Ember.Object.create({
'text': currentNotebook.get('title'),
'state' : {'opened' : false, 'selected' : false },
'children': []
});
big_hash = {
:random_key => [
1, 2, "three", {
:foo => "bar",
:bar => "foo"
}
],
:another_key => 2,
:yet_another => {
:lorem => {
@omarismail
omarismail / latency.txt
Created November 2, 2015 14:44 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns
Send 1K bytes over 1 Gbps network 10,000 ns 0.01 ms
Read 4K randomly from SSD* 150,000 ns 0.15 ms
@omarismail
omarismail / hanoi.rb
Created April 23, 2016 15:41
Towers of Hanoi
def move(num_disks, start, mid, last)
if num_disks == 1
@towers[last] << @towers[start].pop
puts "Move disks from #{start} to #{last} : #{@towers}"
else
move(num_disks-1, start, last, mid)
move(1, start, mid, last)
move(num_disks-1, mid, start, last)
end
end
@omarismail
omarismail / service-checklist.md
Created September 17, 2016 11:45 — forked from acolyer/service-checklist.md
Internet Scale Services Checklist

Internet Scale Services Checklist

A checklist for designing and developing internet scale services, inspired by James Hamilton's 2007 paper "On Desgining and Deploying Internet-Scale Services."

Basic tenets

  • Does the design expect failures to happen regularly and handle them gracefully?
  • Have we kept things as simple as possible?

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