Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Xp - agile programming tools in Coffeescript (github.com/marak)
16 points by reddittor on April 5, 2011 | hide | past | favorite | 6 comments


For the love of Kernighan & Ritchie, please do not promote this as "a convenience library aimed towards non-expert users." The only way beginners are going to learn is experimenting with the command line, not having their hands held with a tiny subset of what's available.

And the positioning -- what's agile about knowing your public ip or uploading images to imgur? Is this a belated April Fool's day joke I'm not getting?

Ok, now that I'm done venting, here's the *nix equivalents for all but the pair command (will edit in. EDIT: added. also did s/python2/python):

    # base64 is already a command, supports -d

    function imgur_up() {
      curl -F key=yourkeyhere -F "image=@$1" http://api.imgur.com/2/upload
    }   
        
    function public_ip() {
      curl -sL myip.dk | egrep '[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}'
    }   

    function sloc() {
      sed '/^$/d' $1 | wc -l
    }

    # no args clears users
    # with args, assigns usernames
    function gpair() {
      if [ -z "$1" ]; then
        echo "Resetting to default user"
        git config --unset-all user.name
      else
        git config user.name "$(echo $@)"
      fi
      echo "User is now: $(git config user.name)"
    }

    function tab_to_space() {
      sed 's/\t/  /g' $1
    }   

    function space_to_tab() {
      sed 's/  /\t/g' $1
    }   

    function url_decode() {
      echo "$1" | python -c 'import sys,urllib;print urllib.unquote(sys.stdin.read().strip())' 
    }   

    function url_encode() {
      echo "$1" | python -c 'import sys,urllib;print urllib.quote(sys.stdin.read().strip())'
    }   

    function web_serve() {
      python -m SimpleHTTPServer
    }
EDIT: Brought to my attention: http://news.ycombinator.com/item?id=1448309 =\


"The only way beginners are going to learn is experimenting with the command line, not having their hands held with a a tiny subset of what's available."

    function public_ip() {
      curl -sL myip.dk | egrep '[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}'
    }
Do you seriously think that people should have to type that text mess for the sake of "learning?" In fact, except for the sed and base64 commands, I'd say none of these are anywhere near trivial.


While I don't agree with your original point, I do appreciate your code! You get a few key benefits from operating inside of the Node environment, but I also think it's important to present users with the *nix way of doing every command. I mention this pretty clearly in the ReadMe

Would you be willing to get a fork going on Github? I don't want to just copy and paste this code without getting a proper attribution going. It would also help out with the collaboration process as I'm sure more people are going to want to update these snippets. I should also point out that most of your commands don't run correctly on my system, I'm running Mac OS 10.6.4. I'm assuming that some of the tools you are referencing have different names or need to be manually installed.


Can you please respond to my point? Your example is flawed since it will only work on a few specific systems.

most of your commands don't run correctly on my system, I'm running Mac OS 10.6.4. I'm assuming that some of the tools you are referencing have different names or need to be manually installed.


Truth be told, if anyone actually gets butthurt because xp duplicates functionality found elsewhere, then they're just being silly. People duplicate functionality all the time. In a lot of cases, we just call it "competition."

So, here's a question: I've noticed that the nodejitsu guys usually use Cloudhead's node-static for static file serving. On the other hand, I usually use Connect's staticProvider. Why do they use node-static over staticProvider? Also, can node-static be used as Connect middleware? Given that fileServer.serve seems to take "req" and "resp" arguments it would seem so, but I also see it being used with the stock http interface in all the examples.


node-static can be used as a "middleware". Here's an example of it being used in Stack: https://github.com/Marak/bugger/blob/master/lib/stack/static...




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

Search: