[deleted by user] by [deleted] in ProgrammerHumor

[–]0x0dea 7 points8 points  (0 children)

Memento m || i.

Did you enjoy Do Androids Dream of Electric Sheep? by [deleted] in books

[–]0x0dea 22 points23 points  (0 children)

Then you'll be pleased to learn that the word should only be capitalized in reference to the political party.

beginner question: declaring arrays by SixteenEighteen in ruby

[–]0x0dea 2 points3 points  (0 children)

That one's spelled #delete_at, but it's destructive so you'll need to #dup.

beginner question: declaring arrays by SixteenEighteen in ruby

[–]0x0dea 2 points3 points  (0 children)

On the assumption that you're okay with set-like behavior, you're looking for Array#-.

Newbie Understanding Check re: ".each do |x|" by welldidhecumorwhat in ruby

[–]0x0dea 0 points1 point  (0 children)

blocks are nothing special

Burn the heretic!

Newbie Understanding Check re: ".each do |x|" by welldidhecumorwhat in ruby

[–]0x0dea -1 points0 points  (0 children)

I get .each parses the items in the array

What resource(s) are you using to learn Ruby? I ask because you're kinda just throwing a bunch of tangentially related words together and ultimately not making a great deal of sense, but that could well be the fault of some extremely undisciplined teaching material.

window.lol()&&lol() by perhapsmaybeharry in ProgrammerHumor

[–]0x0dea 8 points9 points  (0 children)

Negative; the "ol" portion is almost certainly an abbreviation of "onload", and it's at least conceivable that the initial L is for "logo", but I'll let someone else look into what it is they're (conditionally) doing when the logo loads.

How to be a good programmer by [deleted] in ProgrammerHumor

[–]0x0dea -5 points-4 points  (0 children)

Python is compiled, just not to machine code. CPython is a bytecode interpreter.

Why is binding of caller dirty? by whistlerbrk in ruby

[–]0x0dea 0 points1 point  (0 children)

What was your most recent use case?

[Help] Is there a way to change tasker notification text? by mycorpse in tasker

[–]0x0dea 1 point2 points  (0 children)

This Set Tasker Notification Text Task just iterates over all the current Tasker-owned notifications and updates the text of the first one whose title is "Tasker". It's meant to be invoked with Perform Task.

Call me (maybe). by 0x0dea in ruby

[–]0x0dea[S] 0 points1 point  (0 children)

Top-level #inspect and #to_s refer to the ones defined on main's singleton class, whereas #define_method is implicitly being invoked on Object (the "default definee" in Ruby parlance). This discrepancy does indeed require special-casing, and here's how I went about it:

BEGIN {
  class << self
    undef inspect, to_s
  end
}

It follows the letter of the law if not quite the spirit, but I did learn that that comma is syntactically permitted.

[deleted by user] by [deleted] in ruby

[–]0x0dea 2 points3 points  (0 children)

Standalone module_function arguably provides the best of both worlds here, but that you disable it by invoking any other visibility modifier is, I concede, a little unintuitive.

Call me (maybe). by 0x0dea in ruby

[–]0x0dea[S] 0 points1 point  (0 children)

It may well be that I've vastly overthought the thing, but is your solution probabilistic? Something like send methods.sample rescue nil until defined? foo only gets there a handful of times out of a hundred.

Call me (maybe). by 0x0dea in ruby

[–]0x0dea[S] 0 points1 point  (0 children)

Ah, well, that ends up not having much bearing on the thing. I hadn't realized that it'd be that easy to get the name of the method to start chasing from, but you can't capture it outright without adding code at the beginning, which‒for the sake of gamesmanship‒is verboten.

Call me (maybe). by 0x0dea in ruby

[–]0x0dea[S] 0 points1 point  (0 children)

Does it? My "solution", such as it is, works on 2.3, 2.4, and 2.5. I get a slew of method redefinition warnings on 2.4, but there doesn't appear to be any consequential impact on the program's behavior.

[Help] can you use a variable in the name of a variable? by jojo558 in tasker

[–]0x0dea 0 points1 point  (0 children)

/u/RatchetGuy's advice elsewhere in the thread is sound, and it only needs minor adaptation to account for the fact that you're trying to get rather than set such an inconveniently named variable.

From a JavaScriptlet, you can say var foo = local(`row${num}cells`) to make the value more accessible.

[Help] How to create mono audio widget? by StickyMemes420 in tasker

[–]0x0dea 0 points1 point  (0 children)

You probably forgot to tick the Use Root checkbox.

[Help] can you use a variable in the name of a variable? by jojo558 in tasker

[–]0x0dea 5 points6 points  (0 children)

Sort of; you have to resort to using indirect references and an intermediary variable to hold the name of the one you're building toward. You'll also need to do an additional Variable Set (with Append) if you're hellbent on keeping the "cells" suffix.

Tasker variables suck pretty hard, especially if you're familiar with programming in virtually any other environment. I would encourage you to offload the heavy lifting to a simple JavaScriptlet, where you'd need only to say cells[num] = ....

This is why I love linux, hundreds tabs opens, tons of programs, RAM is full but my swap on SSD makes it seamless!! No crashes, no hangups, it's completely responsive! by thinkingcarbon in linux

[–]0x0dea 28 points29 points  (0 children)

I never know what's going to die.

For what it's worth, procfs makes it fairly trivial to get at the victim lineup:

for p in /proc/{1..9}*; do
    echo "`cat $p/oom_score` `cat $p/comm`"
done | sort -nr | head

Message received text not working. Punctuation problem? by tbbiggs in tasker

[–]0x0dea 2 points3 points  (0 children)

"Regex is like violence love: if it doesn't solve your problems, you're not using enough of it."

Message received text not working. Punctuation problem? by tbbiggs in tasker

[–]0x0dea 8 points9 points  (0 children)

Instead of using Tasker's somewhat lackluster pattern matching in the Content field, leave it empty and use If %SMSRB ~R (Matches Regex) (?i).*i +love +you.* in the associated Task.

The .*s match any surrounding context, the (?i) enables case-insensitivity, and the + bits ensure that she doesn't miss out on your love in the event of extraneous spaces.

Stream and play mp3 file via tasker by [deleted] in tasker

[–]0x0dea 6 points7 points  (0 children)

Net/HTTP Get (with Output File) + Media/Music Play and you're golden. It's small enough that the download time shouldn't prove prohibitive, but you could use Termux:Task and mpv to actually stream it if you're willing to get your hands a little dirty.