I was thinking about what Brad Jones had said, so I was thought it might be fun to post what you learned today if anything.
Today I learned iPad pro overlaps desktop styles in css :rolleyes:
Will edit in a solution later..
I was thinking about what Brad Jones had said, so I was thought it might be fun to post what you learned today if anything.
Today I learned iPad pro overlaps desktop styles in css :rolleyes:
Will edit in a solution later..
Today I learned how to convert a datetime object from any timezone to UTC.
$ts = new DateTime($timestamp); // $timestamp is a date-time string
$ts->setTimezone(new DateTimeZone('UTC'));
Today I learned that [man]intval[/man] doesn't use the same integer parsing rules as PHP itself when the given base is 0.
$i = 0b1100;
$s = '0b1100';
echo $i, " ", intval($s, 0);
Weedpacket;11059679 wrote:Today I learned that [man]intval[/man] doesn't use the same integer parsing rules as PHP itself when the given base is 0.
$i = 0b1100; $s = '0b1100'; echo $i, " ", intval($s, 0);
I guess the casting stops as soon as it finds something in the string that is "not a number" in a character sense.
[~]$ php -a
Interactive shell
php > $i = 0b1100;
php > $s = '0b1100';
php >
php > echo $i, " ", intval($s, 0);
12 0
php > $i = 1.3e3;
php > $s = '1.3e3';
php >
php > echo $i, " ", intval($s, 0);
1300 1
php >
Except
$i = 0x1100;
$s = '0x1100';
echo $i, " ", intval($s, 0);
This "seems" to work
@media only screen and (min-width: 769px) and (max-width: 1281px) {
body{
background-color:pink;
}
}
@media only screen and (min-width : 1224px) {
body{
background-color:red;
}
}
From what I noticed it will allow you to target iPad pro while ignoring desktop styles, css sure is user friendly :rolleyes:
Weedpacket;11059683 wrote:Except
$i = 0x1100; $s = '0x1100'; echo $i, " ", intval($s, 0);
This probably includes "yesterday" as well:
If you have a separate "mobile subdomain", Google wants "rel='canonical'" and "rel='alternate'" LINK tags.
Google will begin penalizing sites with insecure login forms.
My co-worker doesn't really look very carefully at data before uploading it. :eek:
A new term...honeypot
<input id="real_email" type="text" name="real_email" size="25" value="" />
<input id="test_email" type="text" name="email" size="25" value="" />
#test_email {
display: none;
}
That you can type most any "time string" into the reminder window in Outlook. I have a reminder set to check email once an hour (so I don't do it more frequently on the one hand, or never on the other). Now, if it's, say, 9:02 when I actually do get around to looking at it, but I still want it to remind me again at 10 AM, I type "58 minutes" into the field. Until this week I was leaving it on the second screen until 9:15, then pulling "15 minutes" from the dropdown, and then pulling "30 minutes" from the dropdown at 9:30, etc.
#yes_I_am_stupid_most_days
#its_the_little_things
Using your face (mainly the forehead) to cushion the impact when you collide with a racquetball court wall is a bad idea.
NogDog;11059733 wrote:Using your face (mainly the forehead) to cushion the impact when you collide with a racquetball court wall is a bad idea.
Ouch!
TIL --- NogDog used to play racquetball.
TIL there's such a sport as racquetball.
function screenWidth()
{
var width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
console.log(width);
}
window.addEventListener("resize", screenWidth);
Everyday is a learning day :p
Also racquetball is a spot, I'm almost sure of it :p
var links = document.getElementsByClassName("my class name").getElementsByTagName('a');
Won't work as it is not a single item
var links = document.getElementsByClassName("my class name")[0].getElementsByTagName('a');
Will work [0] makes the difference between getting the error message getElementsByTagName is not a function and not getting
cluelessPHP;11059791 wrote:var links = document.getElementsByClassName("my class name").getElementsByTagName('a');
Won't work as it is not a single item
var links = document.getElementsByClassName("my class name")[0].getElementsByTagName('a');
Will work [0] makes the difference between getting the error message getElementsByTagName is not a function and not getting
Because you've queried for 3 different classes, "my", "class", and "name" (You've probably already figured this out?)
TIL that there are still good salespeople who speak excellent American English and aren't afraid to call you. Ooh, and also you shouldn't let your wife browse Amazon on your machine while you're logged in. Marshmallow cereal? Thumb-sucking books? Crema Gianduja alle Nocciole?
dalecosp;11059819 wrote:Because you've queried for 3 different classes, "my", "class", and "name" (You've probably already figured this out?)
Oh that was just a place holder, I used
[code=php]
var links = document.getElementsByClassName("deskTopcontrols")[0].getElementsByTagName('a');
[/code]
Maybe that's wrong then?
dalecosp;11059819 wrote:Ooh, and also you shouldn't let your wife browse Amazon on your machine while you're logged in. Marshmallow cereal? Thumb-sucking books? Crema Gianduja alle Nocciole?
Noted for when I find one :p
dalecosp;11059819 wrote:TIL that there are still good salespeople who speak excellent American English and aren't afraid to call you.
Goold ol USA and Wales, both countries always make me feel better about my awful spelling and grammar
var links = document.getElementsByClassName("deskTopcontrols")[0].getElementsByTagName('a');
[FONT=Courier New]document.getElementsByClassName("deskTopcontrols")[/FONT] will get you an array of all elements that have that class. Since an array does not have a [FONT=Courier New]getElementsByTagName()[/FONT] method, you got it to "work" by calling it from the first element in the array (via the 0 index). That means -- I'm pretty sure -- that its result will only include elements that are within that first element of that array; so I'm guessing it's not doing what you really want -- unless you only expect there to be one element with that first class name?
NogDog;11059827 wrote:var links = document.getElementsByClassName("deskTopcontrols")[0].getElementsByTagName('a');
[FONT=Courier New]document.getElementsByClassName("deskTopcontrols")[/FONT] will get you an array of all elements that have that class. Since an array does not have a [FONT=Courier New]getElementsByTagName()[/FONT] method, you got it to "work" by calling it from the first element in the array (via the 0 index). That means -- I'm pretty sure -- that its result will only include elements that are within that first element of that array; so I'm guessing it's not doing what you really want -- unless you only expect there to be one element with that first class name?
I think you're right, was working on something there and hm now I'm sure it's wrong, I'll put in clientside forum
var links = [],
elements = document.getElementsByClassName("deskTopcontrols");
for (var i = 0; i < elements.length; i++) {
links = links.concat(elements[i].getElementsByTagName('a'));
}
// links is now an array of all a tags that are children to deskTopcontrols
TIL that I hate irresponsible dog owners, who let their dog attack mine! (ok actually YESTERDAY I learned that)
TIL there is a room in a hospital in Phoenix that provides medical support for pretty much every long-distance passenger flight in the world.
TIL that the code I write now is much easier to maintain than the code that I wrote 4+ years ago.
NogDog;11059841 wrote:TIL that the code I write now is much easier to maintain than the code that I wrote 4+ years ago.
Good for you! I have a few things like that, and others that still are so "spaghetti like" that I hesitate to touch them, even for the purposes of refactoring. (Just finished on one of those, basically "grep mysql" and once that was all changed to "mysqli" just test it and let it go live
(Of course, even THAT isn't as bad as yesterday, in which I had to perform the same edit on the same line of 5 dozen different files that could've all been the same file with a variable switch ... fortunately that was someone else who wrote that stuff .... )
dalecosp;11059847 wrote:Good for you! I have a few things like that, and others that still are so "spaghetti like" that I hesitate to touch them, even for the purposes of refactoring. (Just finished on one of those, basically "grep mysql" and once that was all changed to "mysqli" just test it and let it go live
(Of course, even THAT isn't as bad as yesterday, in which I had to perform the same edit on the same line of 5 dozen different files that could've all been the same file with a variable switch ... fortunately that was someone else who wrote that stuff .... )
Yeah...had to change one API's output and wasn't sure what files I might have to touch. Turned out the entire fix took place in one method that was only a few lines long -- if you consider the array definition that took about 20 editor lines to be one line.
Derokorian;11059833 wrote:
var links = [], elements = document.getElementsByClassName("deskTopcontrols"); for (var i = 0; i < elements.length; i++) { links = links.concat(elements[i].getElementsByTagName('a')); } // links is now an array of all a tags that are children to deskTopcontrols
Much cleaner
Today I learned, don't drop strange looking objects in work, they are normally fragile and are worth a lot of money
NogDog;11059851 wrote:Yeah...had to change one API's output and wasn't sure what files I might have to touch. Turned out the entire fix took place in one method that was only a few lines long -- if you consider the array definition that took about 20 editor lines to be one line.
Noice
To make matters a tad worse, the 50+ files were in ColdFusion and over 6 years old on a site that gets nearly no traffic. (Of course, now that it's fixed maybe it'll get more?)
Today I learned to use dmd.
cluelessPHP;11059853 wrote:Much cleaner
Today I learned, don't drop strange looking objects in work, they are normally fragile and are worth a lot of money
Today I learned that clueless may be as clumsy as me
Derokorian;11059857 wrote:Today I learned that clueless may be as clumsy as me
Fun isn't it?
Today I learned what one might consider an insult in one country may be a complement in another
Derokorian;11059857 wrote:Today I learned that clueless may be as clumsy as me
Hey, I'm the one who ran into a wall with his face.
TIL our new kitten can escape a closed and locked cat cage. Still haven't learned how.
TIL how to create a Rails rake task.
Today I learned Ethan Brown is a clever man
Today I learned how to "monkey patch" a built-in class in Ruby.
[~/projects/railsapp]$ irb
2.2.1 :001 > foo = 0.66666666666
=> 0.66666666666
2.2.1 :002 > bar = 0.66666666667
=> 0.66666666667
2.2.1 :003 > foo == bar
=> false
2.2.1 :004 > class Float
2.2.1 :005?> def ==(other)
2.2.1 :006?> return (self - other).abs < 0.000000005
2.2.1 :007?> end
2.2.1 :008?> end
=> :==
2.2.1 :009 > foo == bar
=> true
Today I learned switch case in JavaScript is more or less the same as php
Today I learned if I open my window and place my laptop on the window shelf I can pick up the free wifi signal outside
Today I learned
<script type="text/javascript">
<!--
var findlength = "cake is not a lie";
var counter = findlength.length;
var validInput = 40;
result = (counter > validInput) ? true : false;
if(result === true)
{
console.log("clever boy");
}
else if(result === false)
{
console.log("ben dan laowai");
}
console.log(counter);
//-->
</script>
I have a feeling this might have been one of the most important things I've learned to date
TIL that in Lua the most efficient way to determine the number of elements in an arbitrary table (that's array to you and me) is
local count = 0
for _ in pairs(thetable) do count=count+1 end
And the length [font=monospace]#[/font] operator is only well-defined if the table's keys are consecutive integers starting from 1, ignoring (and not counting) non-integer-keyed entries.
Today I learned you can try {} catch in JavaScript
Today I learnt how to "pick up a signal" and tether my laptop to it via mobile phone :o
More about Lua.
While you can use tables as keys in other tables, tables have object identity, so doing so causes awkwardnesses.
local tab = {}
tab[{"a", "b", "c"}] = "foo"
tab[{"a", "b", "c"}] = "bar"
Now [font=monospace]tab[/font] contains two elements, which you can iterate over (while of course the length operator reports zero).
Further,
tab[{"a", "b", "c"}] == "foo"
would evaluate to [font=monospace]false[/font] and
print(tab[{"a", "b", "c"}])
outputs the string "[font=monospace]nil[/font]".
That's because each of those four "abc" tables is a different entity.
So if you want to use tables as keys, you would need to store them somewhere in order to refer to them as needed. Probably store them in another table. With a value-type key so that you can look up specific members. At which point you'd wonder why you didn't use the value-type key in the first place.