Skip to content

Instantly share code, notes, and snippets.

@jcoglan
jcoglan / cover-letter.md
Created May 10, 2011 23:38
How to write a cover letter

Dear XCorp / Hi, XCorp depending on familiarity

I'm writing in response to X, where you advertised a vacancy for Y. I am interested in applying for this role -- please find my CV attached.

My current employment position is X, which means I'm responsible for delivering/organising/producing A, B, and C. I was previously the Y at Z where I did D. My main responsibility / largest project here has been P, which is a Widget that produces Doo-dads.

While I enjoy working at X for reasons K and L, I find M frustrating. I'm also looking to move on into areas such as N, P and Q, without losing touch with K. I find K valuable but I would prefer to change my working environment to include P.

I'm particularly interested in XCorp because, as well as providing the career experience I'm after, I use your product / admire your work / look up to your staff for these reasons: ...

source 'https://rubygems.org'
gem 'faye-websocket', '0.4.7'
gem 'thin'

benchmark: reduce(), filter(), map(), transducers and for loops

reduce()        10            x 574,156 ops/sec ±1.34% (86 runs sampled)
reduce()       100            x 42,746 ops/sec ±1.99% (88 runs sampled)
reduce()     1,000            x 781 ops/sec ±1.61% (88 runs sampled)

filter() & map()        10    x 128,652 ops/sec ±1.21% (87 runs sampled)
filter() & map()       100    x 9,537 ops/sec ±1.22% (90 runs sampled)
filter() & map()     1,000    x 256 ops/sec ±1.07% (81 runs sampled)

filter() & map() 10,000 x 67.54 ops/sec ±2.56% (68 runs sampled)

This document is intended to be a simplified version of the OAuth 2.0 specification. In particular it has been written with implementors in mind, and as such attempts to trim the spec down to just what you need to implement an OAuth provider or client. It is necessarily not complete, but attempts to introduce spec requirements in the same order in which the protocol proceeds in practise, with everything you need to know about each protocol endpoint brought together in one place rather than scattered across a large document.

$VERBOSE = nil
require File.expand_path('../rooby', __FILE__)
Person = Rooby::Class.new 'Person' do
define :initialize do |name|
@name = name
end
define :name do
def combos(items, k, s = 0, combo = [])
return [combo] if k == 0
(s .. items.size - k).flat_map do |i|
combos(items, k - 1, i + 1, combo + [items[i]])
end
end
combos([:a, :b, :c, :d, :e, :f], 3).each do |combo|
p combo
// When I run `tput cols` in the shell, it prints '270'.
// When I run `tput cols` inside a Ruby program, it returns '270'.
// When I run this program, is prints '80'.
// WTF?
import java.lang.*;
import java.io.*;
public class Tput {
public static void main(String[] args) throws IOException {
input_path = File.expand_path('../input.txt', __FILE__)
masses = File.read(input_path).lines.map(&:to_i)
def fuel(mass)
(mass / 3.0).floor - 2
end
p masses.reduce(0) { |s, m| s + fuel(m) }
def required_fuel(init)
var BVT = function(width, depth, init, elems) {
this._width = width;
this._depth = depth;
this._leaf = depth === 1;
this._shift = (this._depth - 1) * Math.round(Math.log(width) / Math.log(2));
this._himask = this._width - 1;
this._lomask = Math.pow(2, this._shift) - 1;
this._elems = elems;

Rust types reference

Prelude

  • std::borrow::ToOwned
  • std::boxed::Box
  • std::clone::Clone
  • std::cmp::{PartialEq, PartialOrd, Eq, Ord}
  • std::convert::{AsRef, AsMut, Into, From}
  • std::default::Default