Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Not going to SXSW, but...

     tr ',' '\n' | sort -n | uniq -d


It's also pretty easy to do in Excel, favored tool of "marketing gurus". Find/replace, import, pivot.


I actually found a solution for it in excel before writing the following:

  asort($data);
  $duplicate = function ($val) use (&$data) {
    $count = 0;
    foreach ($data as $i => $entry)
      if ($val == $entry) $count++;
    return $count;
  };

  foreach ($data as $v)
    if (($count = $duplicate($v)) > 1) {
      printf("%d, Count %d\n", $v, $count);
      break;
    }
I assume it would be possible to use a sort+callback to return the value as well.


sort + callback is what I did in JavaScript:

    .sort(function(a,b){if(a==b){throw a;}return a-b;});


Did you eval the dom to get the dataset?


I did :)

  JSON.parse(p.innerHTML.split('\n')[2])


The point was posting a hack. "most" people don't know unix shell.

I'd consider your mention of Excel to be a hack, as I honestly don't have a clue with it beyond the basics.


  x = File.read('puzle.txt')
  y = x.split(/ \w /)
  module Enumerable
    def dups
      inject({}) {|h,v| h[v]=h[v].to_i+1; h}.reject{|k,v| v==1}.keys
     end
  end
  d = y.dups
  require 'mathn'
  dp = []
  d.each {|z| z = z.to_i; dp << z if z.prime?}
  dp




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: