TIL how to link a subdomain, was a lot easier than I thought it would be
Today I learned
seems like a good one to know
var observer = new IntersectionObserver(function(entries) {
var div = document.querySelector('.my-work');
if(entries[0].isIntersecting === true)
div.classList.add("visable");
}, { threshold: [0] });
observer.observe(document.querySelector("#my-work"));
- Edited
Today i learned how to work from home and earn money through internet...!**
This one surprised me. UNIX-y systems have cat(1), as many of us know:
cat file.txt file2.txt > combined.txt
I was surprised by this on Windows, though:
copy *.csv combined.csv
Did everyone else just know that and I'm only learning 20 years later?
I didn't know about that (or if I did I long forgot it); I use a port of cat on Windows.
Today I learned
$foo = 'hello world!';
$foo = ucwords($foo);
echo $foo;
Today I learned
$a = [1, 2, 3];
$b = [4, 5, 6];
$c = [...$a, ...$b];
var_dump($c);
But that doesn't work if the arrays have string keys.
Reminds me that yesterday I learned that in Ruby you can do:
$ irb
2.4.0 :001 > test = ['a', 'b', 'c', 'd']
=> ["a", "b", "c", "d"]
2.4.0 :002 > test - ['c']
=> ["a", "b", "d"]
Today I learnt e.preventDefault stops checkbox from being checked....why didn't I know that?
TIL (okay, a couple days ago) that there is a json_agg()
function in PostgreSQL.
SELECT
r.review_id,
r.review_timestamp,
json_agg(a.*) AS answers
FROM $schema.review r
INNER JOIN $schema.answer a ON a.review_id = r.review_id
WHERE -- stuff
GROUP BY review_id, review_timestamp
Now I get just one row returned for each relevant review, and each row contains a JSON string with all the answers associated with that review.
- Edited
$schema.answer
Not sure why my brain is expecting a ? or :schema.answer there
cluelessPHP Not sure why my brain is expecting a ? or :schema.answer there
We use Postgres's "schemas" to separate each client's data -- functionally similar to having them each in their own database, except they're not. That query was actually extracted from the PHP code that builds the query (and simplified and anonymized here), so
$schema
would actually be replaced with the relevant schema name for the client being processed, e.g FROM client_foo.review r
, and then processed with $pdo->prepare()
.
Today I learned Sean Connery died
cluelessPHP
This saddened me a bit. Watched "You Only Live Twice" and "Thunderball" this weekend in his honor. Wish I had a copy of "Robin and Marian", the chemistry he had with Audrey Hepburn was amazing. And I might be a fan indeed as I don't even hate Zardoz TOO much.
Finally, pretty good compilation of the early Bond themes: https://youtu.be/J4jdUhxOz0M
dalecosp I watched Highlander
dalecosp
I still like his turn in "The Name of the Rose".
Today I learned that I'm not the only person who has seen Zardoz. That movie is awesomely crap-tastic. https://www.youtube.com/watch?v=AfuK_KJTRyg
"The gun is good" --- family motto. ;-)
dalecosp you might not like what else ol' Zardoz has to say...