Skip to content

Instantly share code, notes, and snippets.

View hjr3's full-sized avatar

Herman J. Radtke III hjr3

View GitHub Profile
let new_col: Vec<&str> = col.iter().map(|&a| {
(a, 1)
}).sort_by(|&a, &b| {
a.1.cmp(&b.1)
}).map(|(col, _score)| col ).collect();
@hjr3
hjr3 / example.rs
Created January 27, 2015 22:55
How to work around the fact that there is no Iterator::sort_by() method.
fn compute_matches(choices: &Vec<String>, query: &str) -> Vec<String> {
let unsorted_matches: Vec<(&String, f64)> = choices.iter().map(|choice| {
(choice, score(choice.as_slice(), query))
}).filter(|&(_choice, score)| {
score > 0.0
}).collect();
let mut matches = unsorted_matches.clone();
matches.sort_by(|&(_choice_a, score_a), &(_choice_b, score_b)| {
fn main() {
let letters = ["a", "a", "b"];
let _filtered_letters: Vec<&str> = letters.iter().map(|letter| {
(letter, 1)
}).filter(|&(_letter, score)| {
score > 0
}).map(|(letter, _score)| {
// I don't want to have to clone() here
letter

I'm sick right now and probably have a fever, so this may make little sense or be completely incorrect. For years, I've been tossing this strange idea around in my head. The goals are:

  • Make associative and sparse data structures cheap and fast.
  • Make memory management trivially simple (no two-step process of adjusting data segment, then allocating from within it; no per-process address spaces).
  • Make memory allocation time very consistent, if not constant.

Note that I have at best a basic understanding of most of the topics here and this is probably pathologically naive. This is not a blog post; it's the kind of thing that I'd send to a friend who knows more than me about these topics.

@hjr3
hjr3 / interviewing.md
Last active August 29, 2015 13:56
Great post on interviewing from @tqbf. Source: https://news.ycombinator.com/item?id=7260087

Broken record: startups are also probably rejecting a lot of engineering candidates that would perform as well or better than anyone on their existing team, because tech industry hiring processes are folkloric and irrational.

I co-manage a consultancy. We operate in the valley. We're in a very specialized niche that is especially demanding of software development skills. Our skills needs also track the market, because we have to play on our clients turf. Consultancies running in steady state have an especially direct relationship between recruiting and revenue.

A few years ago, we found ourselves crunched. We turned a lot of different knobs to try to solve the problem. For a while, Hacker News was our #1 recruiting vehicle. We ran ads. We went to events at schools. We shook down our networks and those of our team (by offering larger and larger recruiting bonuses, among other things).

We have since resolved this problem. My current perspective is that we have little trouble filling slots as we add them, in

@hjr3
hjr3 / motto.md
Created September 25, 2013 16:52
Motto

Keep things simple, be flexible and move quickly.

@hjr3
hjr3 / req.md
Last active February 25, 2020 19:51
Job description for Lead Software Engineer

Lead Software Engineer

HauteLook is seeking a Lead Software Engineer with eCommerce experience for a small, cross functional team. The Lead Software Engineer is focused on implementing the technical road map for their designated team. They own the technical implementation process and ensure that best practices and solid engineering principles are being upheld. Equally important, they have a good attitude and energy that empowers the team.

Responsibilities

  • Write and ship code that has the maximum positive impact for HauteLook members and Hautelook as a business
  • Lead a team of 4-5 engineers to do the same
  • Work with product and project managers to create great products
  • Articulate ideas in ways that are helpful and constructive for other members of the team
@hjr3
hjr3 / req.md
Last active December 22, 2015 16:29
HauteLook job requirement for Platform Engineer

Software Engineer

Job Description:

As an Infrastructure Automation Engineer you will be responsible for the development and production infrastructure that enables HauteLook developers to build products for millions of customers as reliably, rapidly, and frequently as possible. Your primary tasks will be to automate and simplify processes, manage system configurations, integrate disparate systems and manage virtualization/containerization.

The ideal candidate for this job probably has two shirts with the phrase "Shared Nothing" just in case one gets lost. They also realize that DevOps is a culture and not a job description.

Responsibilities:

  • Create and maintain tools for continuous integration of code across development and production. (Automate)
  • Improve the analytics infrastructure to allow the business to become even more data driven. (Measure)
@hjr3
hjr3 / notes.md
Created June 4, 2013 20:42
2013 Los Angeles Ruby Conference Notes

vim & tmux

  • status bar is completely configurable
  • http://goo.gl/98M56
  • can script everything tmux can do. can script splitting windows, etc
  • can add a "send text at start" command to iTerm2
  • ctrl-P + fuzzy search kien.github.com/ctrlp.vim
  • Ag! for a vim aware grep
  • github.com/tpope - a lot of useful vim plugins
@hjr3
hjr3 / memcache.php
Last active December 17, 2015 13:49
Memcache timeout examples
<?php
$m = new Memcache;
$m->addServer('127.0.0.1', 11211);
$m->addServer('127.0.0.1', 11214); // down
$m->set('foo', 'bar');
$foo = $m->get('foo');
var_dump($foo);