HNHacker News
TopNewBestAskShowJobs

jkbr

1,606 karma · joined February 4, 2011

submissionscomments
jkbr··on How `curl -L cueup.com/jobs` works
With HTTPie (master):

   http --pretty=none https://www.cueup.com/jobs User-Agent:curl
(`--pretty=none` is needed because the server incorrectly sends `Content-Type: text/html`)
jkbr··on JetBrains Doomsday Sale - 75% off for 24 hours only
I have used PyCharm daily since its early versions and have been mostly happy with it. When I think about it, it's actually the first IDE for any language I've kept using for longer than a couple of weeks. The best features for me include code navigation, run/test/debug, refactoring, inspections, keyboard-friendliness. It's also got a decent editor and built-in support for Sass and CoffeeScript. Btw, they also provide a free licence for open source development.
jkbr··on Requests, Python HTTP for Humans, reached v1.0
Congrats, Kenneth!

Any hints on how to solve these incompatibilities between HTTPie and Requests v1.0 appreciated: https://github.com/jkbr/httpie/issues/113.

jkbr··on HTTP Headers For Fun & Profit
It's a very recent RFC from June 2012.
jkbr··on Deployd: Create RESTful JSON APIs using a GUI interface
This looks pretty interesting.

A small thing: For cancelled DELETE requests like shown in the video, it would be better to return 403 Forbidden [1] instead of 400 Bad Request [2]:

    10.4.1 400 Bad Request
    The request could not be understood by the server due to malformed syntax.
Vs.

    10.4.4 403 Forbidden
    The server understood the request, but is refusing to fulfill it.
[1] http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10...

[2] http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10...

jkbr··on Show HN: See Kickstarter successes and failures
For macro-level research, it would be useful if every category and filtered view featured accumulated stats (e.g., # of projects/successes/failures).
jkbr··on Array Iteration Interview Problem
My Python version (in-place, no reverse):

    def add1(arr, val, n):
        todo = abs(n) or len(arr)
        seq = xrange(0, len(arr), 1) if n >= 0 else xrange(len(arr) - 1, 0, -1)
        for i in seq:
            if arr[i] == val:
                arr[i] += 1
                todo -= 1
                if not todo:
                    break
        return arr
jkbr··on ~/.osx updated — sensible hacker defaults for OS X Mountain Lion
This:

    # Finder: allow text selection in Quick Look
    defaults write com.apple.finder QLEnableTextSelection -bool true
Combined with "Use OSX Finder Quicklook (Spacebar) to preview all plain text files"[1] is pretty useful.

[1] http://news.ycombinator.com/item?id=4230594

jkbr··on Command line tools for the novice
HTTPie, an easy to use cURL replacement: https://github.com/jkbr/httpie (disclaimer: I'm the author)
jkbr··on OS X Mountain Lion available on the Mac App Store
"Apple Launches 'OS X Server' for Mountain Lion for $19.99" http://www.macrumors.com/2012/07/25/apple-launches-os-x-serv...
jkbr··on Now you lost me
I find feedback mechanisms that allow readers to react to individual parts of text to be useful, especially when the text is of a technical nature.

What I dislike about this particular implementation is the UI: You don't know what happens when you click the button until you have actually clicked it (the same problem has for example the 'kudos' widget on Svbtle[0]). Also the button is slightly obtrusive. Something more subtle with an explanation on hover or a confirmation dialog would IMO do a better job.

A good example of something similar is (the now obsolete) Django Book[1] where people can comment on any paragraph.

[0] e.g. http://500hats.com/late-bloomer/

[1] http://www.djangobook.com/en/2.0/chapter05/

jkbr··on HTTPie: A cURL-like tool for humans
HTTPie also supports proxies and HTTP auth (see --proxy and -a/--auth).
jkbr··on HTTPie: A cURL-like tool for humans
> Hmm, that makes more sense. If it isn't already in the README or man page, it might be a worthy addition.

Good point, I'll add it to the README.

> Is there a way to have it construct the query string [...]

Not yet, but it's being already discussed here:

https://github.com/jkbr/httpie/issues/61

jkbr··on HTTPie: A cURL-like tool for humans
You can still use regular JSON syntax, if you like:

    echo '{"foo": "bar"}' | http url
The reason for having the simplified one is that it's less verbose and usually doesn't even require you to quote it:

    http url foo=bar
jkbr··on HTTPie: A cURL-like tool for humans
Thanks for the feedback!

I tried to come up with syntax that would make the most common tasks (i.e., sending JSON objects, submitting forms, setting headers, etc) as easy as possible and also feel "natural". The reason for the chosen style is that it quite corresponds to the actual HTTP request being sent. For example, if you want to send a PATCH request with a custom header and a form field data:

    PATCH /patch HTTP/1.1
    X-API-Token: 123
    Host: httpbin.org
    Content-Type: application/x-www-form-urlencoded; charset=utf-8

    foo=bar
You can simply copy the header (X-API-Token: 123) and the data (foo=bar) and paste it to the terminal:

    http --form PATCH httpbin.org/post X-API-Token:123 foo=bar
It's not as obvious as '--request PATCH --header X-API-Token:123 --form foo=bar', but on the other hand, the command doesn't include almost anything that wouldn't become part of the actual request, which makes it short and easy to focus on what's important.
jkbr··on HTTPie: A cURL-like tool for humans
There is more to it than that. It provides an expressive syntax to construct all sorts of requests. You can submit forms, upload files and set headers without having to use flags. You also get syntax highlighting, ability to pipe in request data, etc.

If you are sending complex JSON, it's probably stored in a file or it's the output of another program:

    http PUT httpbin.org/put @/data/test.json

    http -b localhost:8888/couchdb/ | http PUT httpbin.org/put
jkbr··on HTTPie: A cURL-like tool for humans
It's not meant to be an insult on cURL. cURL is a great library/tool and supports way more than HTTP, but the command line interface simply isn't as convenient for common HTTP as it could be. The "for humans" slogan is borrowed from the underlying python-requests library and is meant to communicate that good UX is one of the top priorities of the project. Glad you like it!
jkbr··on Use OSX Finder Quicklook (Spacebar) to preview all plain text files
IMO the preview appears automatically after ~2 seconds without having to press any key. Useful feature indeed.
jkbr··on MDB: IMDB data for a folder of movie files. Sort by ratings/genre/runtime
In the footer:

  Source: Freebase, licensed under CC-BY
  Other content from Wikipedia, licensed under CC BY-SA
jkbr··on It's Playtime - Light Table Playground released
Promising. Already now it's quite useful for studying/debugging algorithms. Looking forward to Python support. Recursive call support would be awesome too.
jkbr··on It's Playtime - Light Table Playground released
It's quite similar to Solarized [0] for which there is emacs support [1].

[0] http://ethanschoonover.com/solarized

[1] https://github.com/sellout/emacs-color-theme-solarized

jkbr··on HTTPie: cURL for humans (colorful CLI for python-requests)
thanks, Saevar :)
jkbr··on Xcode, GCC, and Homebrew
> Before installing, note that from within Terminal you can use the XCRUN tool to launch compilers and other tools embedded within the Xcode application. Use the XCODE-SELECT tool to define which version of Xcode is active. Type "man xcrun" from within Terminal to find out more.

> Downloading this package will install copies of the core command line tools and system headers into system folders, including the LLVM compiler, linker, and build tools.

jkbr··on Internet-Draft: A Convention for HTTP Access to JSON Resources
You are right. The aggregation wasn't a good example of an "action".
jkbr··on Internet-Draft: A Convention for HTTP Access to JSON Resources
It defines a generic mechanism for performing actions that don't fit the GET/PUT/PATCH/POST/DELETE model on resources and collections. For example aggregations:

  POST /orders?action=sum&field=price HTTP/1.1

  HTTP/1.1 200 OK
  Content-Type: application/json
  {"sum": 9000}
Or actions with side effects:

  POST /orders?action=process-queue HTTP/1.1

  HTTP/1.1 204 No Content

Which is better than creating a specific resource for each of the "actions", such as /orders_sum_price or /orders_process_queue, because it keeps the URIs clean.
jkbr··on Introducing Times (for Python)
This looks handy.

Btw, Django 1.4 (now alpha) is getting timezone support [1] and its django.utils.timezones [2] features similar functionaliy.

[1] https://docs.djangoproject.com/en/dev/topics/i18n/timezones/...

[2] https://github.com/django/django/blob/master/django/utils/ti...

jkbr··on PyCharm 1.5 Released - now with Django Template Debugging
https://github.com/netzpirat/coffee-brew
jkbr··on Organizing Django settings
> how many developer hours have been spent trying to organize settings, or deal with migrations, or setting up deployment scripts, or coming up with a sensible project layout

Countless. Django prefers configuration over convention. I think it's because there is too much focus on the reusable apps concept. It would be great if it was a little bit the other way around.

← PreviousPage 4 of 4