HN user

jfhufl

70 karma
Posts1
Comments23
View on HN

Unsure what you mean?

    $ ruby -e 'x = "25" ; if x =~ /^\d+$/ ; puts "yes" ; else ; puts "no" ; end'
    yes
    $ ruby -e 'x = "25\n" ; if x =~ /^\d+$/ ; puts "yes" ; else ; puts "no" ; end' 
    yes
    $ ruby -e 'x = "a25\n" ; if x =~ /^\d+$/ ; puts "yes" ; else ; puts "no" ; end'
    no
Also, you'd want to use something that parameterizes the query with '?' (I use the Sequel gem) instead of just stuffing it into a sql string.

Interesting - I may have hyperphantasia? Most of my thoughts are accompanied by images, and I can rotate and unfold things. It's so vivid I seem to have two types of synesthesia:

    https://en.wikipedia.org/wiki/Number_form
    https://www.discovermagazine.com/health/the-rare-humans-who-see-time-and-have-amazing-memories

Nothing is "secure or not" - technologies/mitigations are secure against particular attacks. HTTPS is generally secure against passive network eavesdropping, but does nothing to stop local file inclusion in a web app.

Just because there are attacks or ways around a particular defense doesn't mean it's worthless, that's why we have defense in depth.

This works too:

    % cat /tmp/sh
    var=variables
    x=$(
    cat <<EOT
    This string has 'single' and "double" quotes and can interpolate '$var'
    EOT
    )
    echo $x

    % bash /tmp/sh
    This string has 'single' and "double" quotes and can interpolate 'variables'

Funny, I love Ruby and it's my primary language of choice, but I'm a heretic, using braces whenever I can:

    # events per day
    ndbh.fetch('select ts from tbl').all.map { |row| 
        row[:ts]
    }.map { |t|
        t.strftime('%Y-%m-%d')
    }.each { |day|
        days[day] += 1
    }
(yes this could be conciser)

This is generally frowned on, and I'm sure everyone who likes having this style

   foo
     .map {}
     .select {}
     .blah {}
will frown as well, but it's so much more visually appealing to me, coming from a C/perl background when I first encountered Ruby (many years ago).

Funny how important syntax is. So easy to look at code in another style/language and go THATS NOT RIGHT!!

Seems to me the main difference is that all the particles in the gyro are trying to go in a straight line, but can't due to being a part of a rigid structure. You should be able to tell the difference by dropping a ball bearing. It will land "straight down" if it's gravity, but move "to the side" if it's rotating.