Cut Copy Paste

9 Comments

Comments are ordered by helpfulness, as indicated by you. Help us pick out the gems and discourage asshattery by voting on notable comments.

Got something to add? You can leave a comment below.

  1. Steven Grant

    Always worth listening to is Brendan and one of the best public speakers I’ve heard live.

    Love this comment Some of this stuff is dirty; some of it will make hardcore programmers feel ill. For those people, remember this – while you were complaining about the syntax, I made something.

  2. Aaron Bassett

    remember this – while you were complaining about the syntax, I made something.

    And 6 months down the line when someone else has to maintain it I’m sure they’ll appreciate your cowboy coding.

    Always code as if the person who ends up maintaining your code is a violent psychopath who knows where you live. – Code For The Maintainer

  3. Angela Relle

    I think you could neaten that shell script up a bit (and make it easier to read) using head and tail:

    FIRST=

    for FILE in file*.csv do if [ -z “$FIRST” ] then head -n 1 “$FILE” FIRST=“no” fi tail -n +2 $FILE

    done > file.out

  4. Chris van Hasselt

    I like your simple use of the modulus operator. The modulus operator is very useful in many situations. As you noted, mod 2 is an easy way to determine if something is odd or even, useful for row coloring. Let’s say you have an arbitrary list of names and you want them divided into 4 columns. The names should all have an index number (1st name, 2nd name, etc) associated with them. Use mod 4 to assign the names to the correct columns – 0, 1, 2, 3. The nice thing is, if you need 5 columns, the same logic works, just change to mod 5, and re-flow the list.
    It’s an easy way to put things into a discrete number of buckets.

Impress us

Be friendly / use Textile