Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@JasonPunyon
JasonPunyon / go-bench-plotter.R
Last active May 4, 2018 04:45
Graph the output of go bench
# These lines only need to be run once on each machine to install the libraries I use below.
install.packages("tidyverse")
install.packages("devtools")
devtools::install_github("dgrtwo/drlib")
# End
#After you run those ^^ remove them and save the file...
#Then from a terminal...
#Rscript gobench-plotter.R gobench.input output.png
@JasonPunyon
JasonPunyon / slide_windows.R
Created January 19, 2018 18:49
Fast Slide Windows
slide_windows <- function(tbl, doc_var, window_size) {
tbl %>%
group_by(!!doc_var) %>%
mutate(WordId = row_number() - 1,
RowCount = n()) %>%
ungroup() %>%
crossing(InWindowIndex = 0:(window_size-1)) %>%
filter((WordId - InWindowIndex) >= 0, # starting position of a window must be after the beginning of the document
(WordId - InWindowIndex + window_size - 1) < RowCount # ending position of a window must be before the end of the document
) %>%

Keybase proof

I hereby claim:

  • I am JasonPunyon on github.
  • I am jasonpunyon (https://keybase.io/jasonpunyon) on keybase.
  • I have a public key whose fingerprint is 6C49 6283 EB47 DD96 59B9 1CA2 01E7 2683 EE84 2708

To claim this, I am signing this object:

@JasonPunyon
JasonPunyon / 001-get-wikipedia-information.js
Last active August 29, 2015 14:04
Building a language classifier.
//Ran this in the dev tools console on http://meta.wikimedia.org/wiki/List_of_Wikipedias to get wikipedia information in JSON.
JSON.stringify(jQuery.map($("table:not(.nmbox) tbody tr"), function(tr) {
var wikiLink = $("td:nth-child(4) a", tr);
return {
Language: $("td:nth-child(2) a", tr).text(),
LangCode: wikiLink.text(),
Url: 'http:' + wikiLink.attr('href'),
NumberOfArticles: parseInt($("td:nth-child(5) a", tr).text().replace(/,/g, ""))
};
}).slice(0, 287));
@JasonPunyon
JasonPunyon / SigilFail.linq
Last active August 29, 2015 14:02
Sigil Fail
<Query Kind="Program">
<NuGetReference>Sigil</NuGetReference>
<Namespace>Sigil</Namespace>
</Query>
void Main()
{
Func<string> act = () => {
return Guid.NewGuid().ToString();
};
<Query Kind="Program">
<NuGetReference>Jil</NuGetReference>
<Namespace>Jil</Namespace>
</Query>
void Main()
{
WriteHtml("<div>Hello World!</div>");
WriteHtml("<div id='chartContainer'></div>");
WriteHtml("<script src='http://cdnjs.cloudflare.com/ajax/libs/d3/3.4.4/d3.min.js'></script>");
@JasonPunyon
JasonPunyon / package.json
Last active December 26, 2015 02:29
redis-queued, underscore-templated, markdown-formatted, juice-styled e-mails in not that many lines of code.
{
"name": "philip-j-fry",
"version": "0.1.0",
"author": "Jason Punyon <jason.punyon@gmail.com>",
"description": "delivery boy",
"contributors": [
{
"name": "Jason Punyon",
"email": "jason.punyon@gmail.com"
}
@JasonPunyon
JasonPunyon / Vagrantfile
Created January 29, 2013 00:42
A Vagrant(http://vagrantup.com) setup that creates an ubuntu virtual machine running redis
Vagrant::Config.run do |config|
config.vm.box = "ubuntu-12.04-amd64"
# THE URL FROM WHERE THE 'CONFIG.VM.BOX' BOX WILL BE FETCHED IF IT
# DOESN'T ALREADY EXIST ON THE USER'S SYSTEM.
config.vm.box_url = "http://dl.dropbox.com/u/4031118/Vagrant/ubuntu-12.04.1-server-i686-virtual.box"
config.vm.forward_port 6379, 6379
config.vm.customize ["modifyvm", :id, "--memory", 1024]
config.vm.provision :shell, :path => "init.sh"

Today, this article was posted to hacker news and made the front page. I would like to address the assertion made in the article that if one knows the answers to these types of questions, they will be more prepared for an interview. This kind of thinking about interviews is wrong.

The primary purpose of a programming interview is to assess the candidate's ability to solve problems. If there is any question asked about syntax or language features, a candidate should be wary of accepting any offer.

About six months ago I interviewed with four companies. Having had time to ponder the differences between their interview techniques, I now understand better what I am looking for, as a candidate. One company I interviewed with quizzed me on syntax and language features, and asked me how to do specific things in a specific language. This was not at all what I had prepared for. Now, I know that if I encounter such an interview, I will not work for tha