Skip to content

Instantly share code, notes, and snippets.

@speric
speric / bialetti-tips.md
Last active December 28, 2015 08:08
Bialetti Moka Express tips

Bialetti Moka Express Tips

  • Put hot water inside the chamber just below the valve. Too much air will have your coffee pop out too fast, the process must be as slow as possible.

  • As soon as coffee starts to spill, turn down the heat to minimum and shut it off when 1/3 or 1/2 of the pot is filled. The rest will flow anyhow and you don't get a "tea-like" coffee.

  • Most important: coffee brewing with Moka or Expresso machines strongly depends on atmospheric pressure. You should grind yourself your beans accordingly to weather: good weather (high pressure) will need a finer ground, bad weather will need a coarser ground.

  • The quality of the final products depends also on the filter holes size.

@speric
speric / books.md
Created November 20, 2013 12:59
Books On The Cold War and Espionage

On the KGB, you have the Mitrokhin Archive. Several books got squeezed out of that one, including "KGB: the Untold Story."

There is an official history of MI6 out, but it deals with WWII/early Cold War. It is a multi-volume work in progress.

"Legacy of Ashes" is the CIA book, written by NYT reporter Tim Weiner. While the author tries to be comprehensive, he sticks mostly to CIA failures (because they are public). Successes are too few and/or too secret?

James Bamford's "Body of Secrets" is the better read, focusing on the NSA. Successes and failures get printed.

"Blind Man's Bluff" is a partial history of submarine-based US espionage, notable for its reliance on public documents and interviews with named persons. There are no anonymous sources quoted, ever.

require 'sinatra'
require 'openssl'
require 'json'
post '/' do
body = request.body.read
puts "Time : #{Time.now}"
puts "Actual Signature : #{request.env['HTTP_X_CHARGIFY_WEBHOOK_SIGNATURE_HMAC_SHA_256']}"
puts "Computed Signature: #{signature(body)}"
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@speric
speric / histogram.md
Last active March 4, 2016 20:54
Histogram Solution

Solution

defmodule HistogramCup do
  @moduledoc """
  You are given an input list whose each element represents the height of a line towers.
  The width of every tower is 1. It starts raining. How much water is collected between the towers?

  Input: [1,5,3,7,2] , Output: 2 units
  Explanation: 2 units of water collected between towers of height 5 and 7
@speric
speric / alias_matchers.md
Created October 14, 2016 19:34 — forked from JunichiIto/alias_matchers.md
List of alias matchers in RSpec 3

This list is based on aliases_spec.rb.

You can see also Module: RSpec::Matchers API.

matcher aliased to description
a_truthy_value be_truthy a truthy value
a_falsey_value be_falsey a falsey value
be_falsy be_falsey be falsy
a_falsy_value be_falsey a falsy value
@speric
speric / x.md
Last active December 10, 2016 06:54
Introducing Phoenix: Concurrent

An excerpt from Programming Phoenix by Chris McCord, Bruce Tate, and José Valim


You won’t find a "PhoenixDelayedJob" or "ElixirResque", those complex packages that exist only to spin off reliable processes as a separate web task.

You don’t need one. Don’t get us wrong. In Ruby, those packages are well-conceived and a critical part of any well-crafted solution. In Elixir, those frameworks turn into primitives. The Elixir programming model makes reasoning about concurrent systems almost as easy as reasoning about single threaded ones. When you have two database fetches, you won’t have to artificially batch them together with a stored procedure or a complex query. You can just let them work at the same time, like this:

company_task  = Task.async(fn -> find_company(cid) end)
@speric
speric / pow.md
Last active December 8, 2017 23:03
Use .test domain locally with pow

You'll need to reinstall pow after updating the POW_DOMAINS env var (see http://pow.cx/manual#section_3.1 for more details).

echo "export POW_DOMAINS=test,local" > ~/.powconfig
curl get.pow.cx | sh

Now you should be able to access your local apps (that are being server by pow) at the .test domain.

See also: basecamp/pow#547

@speric
speric / code-review.md
Created January 8, 2020 18:44
What should we look for when doing code review?

Code Review

What should we look for when doing code review? How should we receive code reviews from others?

thoughbot's Code Review guide is a great starting point. It articulates principles for the relational side of code review. This is especially relevant for us in a remote environment. How we give and receive feedback is as important as the feedback itself.

Things To Look For In Code Review

The following is a very incomplete list of questions to ask yourself during code review. The items here are meant to be starting points for a conversation with the code's author. Always assume the best intentions.

I highly suspect that the RSpec core team all use black backgrounds in their terminals because sometimes the colors aren’t so nice on my white terminal

I certainly use a black background. I'm not sure about the other RSpec core folks. Regardless, if there are some color changes we can make that would make output look good on a larger variety of backgrounds, we'll certainly consider that (do you have some suggested changes?). In the meantime, the colors are configurable, so you can change the colors to fit your preferences on your machine. First, create a file at