HN user

sferik

2,252 karma
Posts51
Comments28
View on HN
sferik.github.io 4mo ago

Minitest-Strict 1.0.0 for Ruby

sferik
2pts0
www.haggadot.com 3y ago

Chat GPT Haggadah Supplement

sferik
21pts8
www.haggadot.com 3y ago

Chat GPT Haggadah Supplement

sferik
2pts0
patshaughnessy.net 4y ago

To learn a new language, read its standard library

sferik
402pts236
www.paulgraham.com 5y ago

The Reason to End the Death Penalty

sferik
21pts1
techcrunch.com 5y ago

Twitter acquires social podcasting app Breaker

sferik
6pts1
everythingstudies.com 5y ago

Notes on Notes

sferik
2pts0
teachablemachine.withgoogle.com 6y ago

Google Teachable Machine

sferik
2pts0
www.mnot.net 7y ago

Moving Control to the Endpoints

sferik
1pts0
9to5mac.com 8y ago

What’s the best podcast app for iPhone?

sferik
2pts0
ridiculousfish.com 8y ago

JavaScript's Tricky Rounding (2018)

sferik
2pts0
medium.com 8y ago

New Podcast: Venture Stories by Village Global

sferik
1pts0
pubpub.ito.com 8y ago

Designing Our Complex Future with Machines

sferik
2pts0
www.scottaaronson.com 8y ago

Scott Aaronson’s Big Numbers Talk at Festivaletteratura

sferik
1pts0
www.forentrepreneurs.com 8y ago

The Most Important Startup Question

sferik
1pts1
medium.com 8y ago

How to skip silences in podcasts with AVAudioPlayer

sferik
7pts1
mikeindustries.com 9y ago

Shipping vs. Learning

sferik
2pts0
abovethecrowd.com 10y ago

On the Road to Recap

sferik
117pts9
intermezzos.github.io 10y ago

IntermezzOS: a teaching operating system for experienced developers

sferik
67pts8
stratechery.com 10y ago

Twitter's Moment

sferik
3pts0
www.michaelevensen.com 11y ago

Building SoundCloud’s iPhone app

sferik
3pts1
developer.apple.com 12y ago

Swift Blog

sferik
177pts64
sealedabstract.com 12y ago

Conduct unbecoming of a hacker

sferik
1pts0
blog.alexmaccaw.com 12y ago

How to travel around the world for a year

sferik
3pts0
news.ycombinator.com 12y ago

Ask HN: [Coin] How many debit/credit cards do you carry?

sferik
7pts10
gigaom.com 12y ago

SoundCloud open-sources Sketchy

sferik
4pts0
twitter.com 12y ago

Tim Cook is on Twitter

sferik
11pts3
bennettfeely.com 12y ago

CSS Creatures

sferik
2pts0
blog.noupsi.de 12y ago

Pregnancy and competence

sferik
1pts0
backstage.soundcloud.com 12y ago

Win a trip to the Barcelona Ruby Conference

sferik
1pts0

Breaker is a social podcast software company. Learn more at https://www.breaker.audio/i/about.

We are currently looking to hire two people:

1. A full-time senior iOS developer, preferably ONSITE in San Francisco, but open to REMOTE.

2. A part-time community manager, starting at ~10 hours per week, with an opportunity to scale with the company. REMOTE friendly. Must love podcasts.

More information at https://www.breaker.audio/i/jobs.

Please send inquiries to jobs@breaker.audio

My Weird Ruby 11 years ago

Can someone who doesn't like symbols help me understand the downsides of them?

I wish I had been clearer in my talk but I only had 30 minutes and wanted to cover other topics. Here is a more comprehensive argument against symbols in Ruby:

In every instance where you use a literal symbol in your Ruby source code, you could you could replace it with the equivalent string (i.e. calling Symbol#to_s on it) without changing the semantics of your program. Symbols exist purely as a performance optimization. Specifically, the optimization is: instead of allocating new memory every time a literal string is used, lookup that symbol in a hash table, which can be done in constant time. There is also a memory savings from not having to re-allocate memory for existing symbols. As of Ruby 2.1.0, both of these benefits are redundant. You can get the same performance benefits by using frozen strings instead of symbols.

  "string".freeze.object_id == "string".freeze.object_id
Since this is now true, symbols have become a vestigial type. Their main function is maintaining backward compatibility with existing code. Here is a short benchmark:
  def measure
    t0 = Time.now
    yield
    t1 = Time.now
    return t1 - t0
  end

  N = 1_000_000

  puts measure { N.times { "string" } }
  puts measure { N.times { "string".freeze } }
  puts measure { N.times { :symbol } }
There are a few things to take away from this benchmark:

1. Symbols and frozen strings offer identical performance, as I claim above.

2. Allocating a million strings takes about twice as long as allocating one string, putting it in into a hash table, and looking it up a million times.

3. You can allocate a million strings on your 2015 computer in about a tenth of a second.

If you’ve optimized your code to the point where string allocation is your bottleneck and you still need it to run faster, you probably shouldn’t be using Ruby.

With respect to memory consumption, at the time when Matz began working on Ruby, most laptops had 8 megabytes of memory. Today, I am typing this on a laptop with 8 gigabytes. Servers have terabytes. I’m not arguing that we shouldn’t be worried about memory consumption. I’m just pointing out that it is literally 1,000 times less important that it was when Ruby was designed.

Ruby was designed to be a high-level language, meaning that the programmer should be able to think about the program in human terms and not have to think about low-level computer concerns, like managing memory. This is why Ruby has a garbage collector. It trades off some memory efficiency and performance to make it easier for the programmer. New programmers don’t need to understand or perform memory management. They don’t need to know what memory is. They don’t even need to know that the garbage collector exists (let alone what it does or how it does it). This makes the language much easier to learn and allows programmers to be more productive, faster.

Symbols require the programmer to understand and think about memory all the time. This adds conceptual overhead, making the language harder to learn, and forcing programmers to make the following decision over and over again: Should I use a symbol or a string? The answer to this question is almost certainly inconsequential but, in the aggregate, it has consumed hours upon hours of my (and your) valuable time.

This has culminated in objects like Hashie, ActiveSupport’s HashWithIndifferentAccess, and extlib’s Mash, which exist to abstract away the difference between symbols and strings. If you search GitHub for "def stringify_keys" or "def symbolize_keys", you will find over 15,000 Ruby implementations (or copies) of these methods to convert back and forth between symbols and strings. Why? Because the vast majority of the time it doesn’t matter. Programmers just want to consistently use one or the other.

Beyond questions of language design, symbols aren’t merely a harmless, vestigial appendage to Ruby. They have been a denial of service attack vector (e.g. CVE-2014-0082), since they weren’t garbage collected until Ruby 2.2. Now that they are garbage collected, their behavior is even closer to a frozen string. So, tell me: Why do we need symbols, again?

I should mention, I’d be okay with :foo being syntactic sugar for a frozen string, as long as :foo == "foo" is true. This would go a long way toward making existing code backward compatible (of course, this would cause some other code to break, so—like everything—it’s a tradeoff).

I’m curious how Europe’s tech hubs (specifically London, Paris, and Berlin) compare to U.S. cities.

I suspect Berlin would compare quite favorably, despite the relatively high German tax rate. I moved there 18 months ago and currently pay €500 ($565) for a one-bedroom apartment in a nice part of town (Prenzlauer Berg). In San Francisco, I paid 5X that for a studio apartment in Hayes Valley.

The problem with this funding model is that it encourages fluff pull requests, such as this one: https://github.com/sferik/t/pull/138/files.

If there was no financial incentive, I would probably merge it but now I'm questioning the motivations of the committer. If I merge this, it means there will be less money for someone else, who makes a more significant contribution in the future.

Personally, I prefer Gittip’s model to incentivize open-source contributions, if only because it doesn’t create this kind of noise for project maintainers.

Yes, that's the point. As people spend more of their time and attention on social media relative to other media, where will those branding budgets go? Not to Google (well, actually, that's why they bought YouTube...but not to Google Search).

Twitter is one of the few outlets where brands can effectively communicate their message online. That's the theory, anyway. You can argue that Twitter is a bad medium for branding but arguing that it's a bad medium for direct response advertising is missing the point.

What you are describing is direct response advertising.

There is another type of advertising called branding. Budweiser doesn’t spend $25 million per year advertising during the Super Bowl because they expect you to see the advertisement and immediately order a beer at the bar. Instead, Budweiser is trying to tell you a story about their brand to evoke an emotional response that will be stored deep in your amygdala such that every time you go to buy beer in the future you will reflexively choose Budweiser.

Google is better for direct response advertising; Twitter is better for branding.

PS: There is more money in brand advertising.

That's correct. But I'm planning to remove this functionality anyway, just to be safe. It's too easy to accidentally open this vulnerability and it's unclear what the valid use-case is for parsing YAML or symbols from XML.

When I implemented this functionality, it was only to be compatible with the Rails parser.

The rules were changed in 2010 to allow texting/tweeting.

Here's a link to this year's official WSOP rules: http://www.wsop.com/2012/2012-WSOP-Rules.pdf (see section 61 on Communication)

Here's the relevant part: "Participants not involved in a hand (cards in muck) shall be permitted to text/email at the table, but shall not be permitted to text/email any other Participant at the table."

Arguably, a public tweet could be interpreted as a text or email to another participant at the table, but the rules are not enforced that way and tweeting is a generally accepted practice by pros and amateurs alike.

T happens to be written in Ruby but it's a CLI, not a Ruby library. The fact that it is packaged as a gem is incidental. T was designed to be called from a command line shell and to interoperate with other Unix utilities like grep, cut, awk, bc, wc, xargs, etc. All output is streamed to stdout, so it actually makes just as much sense to call t from a shell script (or, for that matter, from a Perl or Python script) as it does from Ruby.

Given your response, you might be surprised at the number of angel (or even Series A) investments made almost exclusively on the basis of the individuals involved, sans any tangible product or traction.

The thing that holds Kickstarter projects together is putting one's own credibility on the line. The people who pledge, understand that it would not be worth me publicly destroying my reputation for $2000. And since I haven't solicited pledges above $64, I would argue that I'm taking on a much greater risk than any individual contributor.

I view Kickstarter primarily as a tool for customer discovery, to gauge whether a project is worth my time. It has the added benefit of building momentum behind the project by creating a small army of people who are, quite literally, invested in it.

There are probably other names for this process, but I like to call it IDD: icon-driven development.